Zasilkovna Free Shipping if Subscription in Cart

0.0/5
<?php
add_action( 'woocommerce_before_cart', 'bbloomer_find_product_in_cart' );
add_action( 'woocommerce_checkout_update_order_review', 'bbloomer_find_product_in_cart' );
    
function bbloomer_find_product_in_cart() {
  
   $product_id = 401;
  
   $product_cart_id = WC()->cart->generate_cart_id( $product_id );
   $in_cart = WC()->cart->find_product_in_cart( $product_cart_id );
  
   if ( $in_cart ) {
	  add_filter('zasilkovana_free_shipping_filter', 'wpd_free_shipping', 10);
  	  add_filter('zasilkovna_shipping_cost', 'wpd_zasilkovna_shipping_cost', 10, 3); 
   }
  
}

function wpd_zasilkovna_shipping_cost($cost, $moje_country, $weight) {
	return 0;
}

function wpd_free_shipping()
{
	return 0;
}

Comments and reviews

{{ reviewsTotal }} Review
{{ reviewsTotal }} Reviews
{{ options.labels.newReviewButton }}
{{ userData.canReview.message }}

Description

This snippet was fetched automatically from WPDistro.cz projects.

Author

Tags

This snippet is untagged