// Woocommerce overrides
// Disabling some/all default CSS: https://docs.woocommerce.com/document/disable-the-default-stylesheet/
+body:not(.woocommerce-app)
+ .frequency,
+ .product-frequency
+ display none !important
+
.woocommerce
// Headings
h2
button[type="submit"]
width: max-content
+ .woocommerce-cart-form
+ .product-price
+ display: none
+
div.product
form.cart
div.quantity
return '';
});
-
-add_filter('wps_sfw_price_html', function(){
+add_filter('wps_sfw_price_html', function($html){
global $product;
- if($product) {
+ if($product && !is_page(['cart','panier'])) {
$symbol = get_woocommerce_currency_symbol();
$price = apply_filters('wps_rbpfw_price', $product->get_regular_price());
$suffix = $product->get_price_suffix();
return "<span class='woocommerce-Price-amount amount'><bdi><span class='woocommerce-Price-currencySymbol'>$symbol</span>$price</bdi></span><small class='woocommerce-price-suffix'>$suffix</small>";
+ }else{
+ return $html;
}
});
return $price;
});
-add_action('woocommerce_after_add_to_cart_quantity', function() {
- global $product;
- $product_id = $product->get_id();
+add_action('woocommerce_after_add_to_cart_quantity', function($product_id = false) {
+ if()
+ if(!$product_id) {
+ global $product;
+ }
+ $product_id = $product_id ?? $product->get_id();
$wps_price_html = "<div class='frequency'>";
$wps_price_html .= "<p>Frequency</p>";
$wps_price_html .= '<div class="wps_sfw_subscription_wrapper">';
$wps_price_html .= '<div class ="wps_wsp_onetimesimple_wrapper">';
$wps_price_html .= '<label for="wps_sfw_check_simple_cart_one_time_purchase"><input name="wps_type_selection" type="radio" class="wps_sfw_check_simple_cart_one_time_purchase" data-pro_type="one_time" value="one_time" id="wps_sfw_check_simple_cart_one_time_purchase" data-id="' . $product_id . '" checked>';
// translators: one time price.
- $wps_price_html .= sprintf( esc_html__( 'One Time', 'woocommerce-subscriptions-pro' ), wc_price( $wps_wsp_onetime_price ) ) . ' ';
+ $wps_price_html .= sprintf( esc_html__( 'One Time', 'woocommerce-subscriptions-pro' )) . ' ';
$wps_price_html .= '</label></div>';
$wps_price_html .= '<div class ="wps_sfw_subscription_inner_wrapper">';
// translators: placeholder is price_discount_percentage.
<th class="product-name"><?php esc_html_e( 'Product', 'woocommerce' ); ?></th>
<th class="product-price"><?php esc_html_e( 'Price', 'woocommerce' ); ?></th>
<th class="product-quantity"><?php esc_html_e( 'Quantity', 'woocommerce' ); ?></th>
+ <th class="product-frequency"></th>
<th class="product-subtotal"><?php esc_html_e( 'Subtotal', 'woocommerce' ); ?></th>
</tr>
</thead>
echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ); // PHPCS: XSS ok.
?>
</td>
-
<?php
- if ( wps_sfw_check_product_is_subscription( $cart_item['data'] ) ) {
+ if ( wps_sfw_check_product_is_subscription( $cart_item['data'] )) {
$wps_skip_creating_subscription = apply_filters( 'wps_skip_creating_subscription', true, $cart_item );
- if ( $wps_skip_creating_subscription ) {
- echo "ok";
- }
+ if ( $wps_skip_creating_subscription ) {?>
+ <td class="product-frequency" data-title="<?php esc_attr_e( 'Frequency', 'woocommerce' ); ?>">
+ <?php do_action('woocommerce_after_add_to_cart_quantity', $product_id); ?>
+ </td>
+ <?php }
}
?>
-
<td class="product-subtotal" data-title="<?php esc_attr_e( 'Subtotal', 'woocommerce' ); ?>">
<?php
echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); // PHPCS: XSS ok.
<?php do_action( 'woocommerce_cart_contents' ); ?>
<tr>
- <td colspan="6" class="actions">
+ <td colspan="7" class="actions">
<?php if ( wc_coupons_enabled() ) { ?>
<div class="coupon">
<?php do_action( 'woocommerce_after_cart_contents' ); ?>
</tbody>
</table>
+
<?php do_action( 'woocommerce_after_cart_table' ); ?>
</form>