Your code is good and shouldn’t be the issue (as long as the shipping rate is active/published and has the condition).
I think its related to the shipping cache; WC doesn’t re-calculate the shipping cost if nothing has changed for the destination (so the billing would be the same as the shipping address).
You can test this by enabling the Shipping debug mode under the ‘Shipping’ settings since WC 3.0, before that under System status > Tools.
If that works and it is calling the function now; you can resolve it completely by adding the value of the checkbox to the shipping package.
function custom_add_package_var( $package ) {
$package['destination']['ship_to_diff_address'] = $my_var;
return $package;
}
add_filter( 'woocommerce_cart_shipping_packages', 'custom_add_package_var' );
(non-functional code above; going from where you got so far I believe this would be enough for you to work with 😉
Related Posts:
- Order by rating not works in wp_query
- WooCommerce changes lost password reset link
- WooCommerce: Add New Report Tab
- Migrate WooCommerce Orders [closed]
- Woocommerce checkout fields on the same line
- display available size on hover, in woocommerce shop page [closed]
- WooCommerce Subscriptions: Show monthly Price for annual Product
- How to add multiple product gallery images from front-end
- Hide income in Woocomercer [closed]
- WooCommerce: Email Notifications
- How do you add custom metadata to WooCommerce orders? Specifically a second external order ID
- WooCommerce: Adding Order Item Meta Data That’s Hidden
- Hide tabs on woocommerce product editor for user role
- Woocommerce add_to_cart non-register visitor not working
- WooCommerce: The model of e-mail is displaying only the html, not css [closed]
- How to show loading spinner after click on add to cart button [closed]
- Authenticate user into wordpress via 3rd party system, both with the same domain
- WordPress select field – show current value?
- Woocommerce – Show random product thumbnail from specific product category
- Arranging Product Details on Shop Page
- How to get woocommerce subscription next payment date or date when subscription expires in woocommerce_subscription_renewal_payment_complete hook?
- Woo-commerce Checkout Summarized in Pop-up Card Entry Only
- Display Message if woocommerce coupon is not applicable to some items in the cart
- (Woocommerce) How to add a custom page between cart and checkout with a file upload field per product item in the cart?
- Force uppercase on some WooCommerce checkout fields input
- Display custom field without plugin in woocommerce
- How to output php between header and woocommerce container
- WooCommerce – How can I make single product gallery show two images on the slider at once?
- How to delete all customer user account that haven’t placed a single order?
- WooCommerce – buying as well as selling
- How do I hide ‘out of stock’ products in the admin ‘product’ page?
- Hide the prefix before the price of the product [closed]
- Backend users list – add Woocommerce meta to table
- Delete cookie when changing url (when navigating away from specific page of website)
- Add custom field to Woocommerce add new attribute / edit page
- woocommerce axios react
- Woocommerce hook on address field change [closed]
- Maintenance mode just for WooCommerce shop pages [closed]
- Custom email template for a specific product category
- update_post_meta not work [closed]
- WooCommerce 4: Gallery size is too large in mobile
- Same request Mysql/Php not same result
- WooCommerce Registration redirect based on page ID
- Get woocommerce coupon code
- Woocommerce change price in cart when discounted
- Migrating data from Woocommerce to another webapp
- Options to develop a non-ecommerce catalog?
- wp_set_object_terms setting only first id from array
- I need to export all products and images but I don’t know which table the images are in
- Add only sku to product url woocoomerce
- How to check if woocommerce_order_item_name is use in email?
- Purchase/order statistics plugin for viewing per payment menthod?
- Displaying Woocommerce Product Attributes on single product page
- WooCommerce – Child Category wont show, but Parent does
- How to hide a random text with a div tag using a class on product pages with a specific tag
- Categories on attribute archive pages
- How to solve `Error getting remote image` in woocommerce rest api script?
- How to let users create lists of woocommerce products?
- How to force Woocommerce to deliver the product to the paypal adress which was used?
- Add username and password section in WooCommerce’s my account page
- Recently viewed products – Order by viewed
- How can i add product Accessories from front-end using custom php form?
- How to save one API response to WooCommerce order meta data
- WooCommerce and ACF: How to Redirect Upon Add to Cart – Partially Working Example
- Woocommerce: Search by custom attribute
- How to change user role after login?
- WooCommerce free shipping twice a week
- Product overlapping header
- remove add to cart for free (0 $) product woocommerce
- merge tabs in woocommerce
- How to import products to Woo Commerce given that WP All Import keeps timing out
- WooCommerce subscriptions give option of manual renewal on checkout [closed]
- Awesome Support Custom Field for show Woocommerce orders
- How to make a custom redirect in WooCommerce?
- Firstname and lastname greyout or hidden Billing details at next checkout like username is hidden [closed]
- How to use woo commerce login to authenticate code php pages?
- Change order status after checkout
- Site with WooCommerce section moved to HTTPS – all pages except home and main store are 404s
- Multiple quantities with options
- how to add custom reviews button in woocommerce order complete generated mail
- Click Count on Download a File
- How to add coupon expiry date into the followup emails?
- Not all strings are translated
- Custom Woocommerce checkout filed yields a Json error when validating [closed]
- access Woo commerce | WordPress methods externally
- How to display Woocommerce catagories
- Woocommerce set single city to sell to
- Trying to link to a custom css file in a new folder
- eCommerce solution doesn’t want to display its shortcodes or any content where it’s set to [closed]
- Woocommerce hidden fields with meta keys and values. how?
- How do I make a diagonal strikethrough on wordpress? [closed]
- Woocommerce – Remove ‘Buy Product’ Button from shop page [closed]
- Add woocommerce.css in template?
- Send data to external websites when there is an update or create a post
- Add a custom code with custom link after add to cart for every product
- WooCommerce product permalink based on product’s current category
- Disable duplicate WC product category URLs
- how should i get products based on tags in woocommerce
- Add custom text to product category page
- Woocommerce permalink URL change in DB