shipping-method

Hide some shipping rates based on taxonomy terms in WooCommerce 4.8+

旧巷老猫 提交于 2021-01-28 18:26:10
问题 I use this to unset shipping for product with specific tag: function specific_products_shipping_methods( $rates, $package ){ // etiquette cocolis $terms = array( 'cocolis' ); $taxonomy = 'product_tag'; foreach( $package['contents'] as $cart_item ) { if ( has_term( $terms, $taxonomy, $cart_item['product_id'] ) ) { unset( $rates['oik_weight_zone_shipping_49'] ); unset( $rates['chrono10'] ); unset( $rates['chrono13'] ); add_filter('woocommerce_shipping_chosen_method', 'reset_default_shipping

Reset previous chosen shipping method in Woocommerce checkout page

喜你入骨 提交于 2021-01-28 05:15:37
问题 Currently, I am clearing the default shipping selection method using this filter: add_filter( 'woocommerce_shipping_chosen_method', '__return_false', 99); However, this only clears it during the initial session of the customer. Once the customer chooses an option even once, it remembers the selection for the future. I am trying to get the checkout to force the customer to pick a shipping option every time they visit the checkout even in the same session. Is it possible to run this filter

Shipping methods only enabled in checkout page on Woocommerce

笑着哭i 提交于 2021-01-27 21:10:47
问题 On Woocommerce, we need to remove the shipping-methods from the Cart section an add it to the Checkout page only. Any track or help should be really appreciated? 回答1: There will be multiple ways to do it depending on the "why?" and on "for what?" you need this: 1) Hide shipping related from cart - The easiest way; add_filter( 'woocommerce_cart_ready_to_calc_shipping', 'disable_shipping_on_cart' ); add_filter( 'woocommerce_cart_needs_shipping', 'disable_shipping_on_cart' ); function disable

How to retrieve Shipping Method of an Order in WooCommerce?

末鹿安然 提交于 2021-01-20 04:52:08
问题 I am developing an eCommerce website on Wordpress using WooCommerce. I want to retrieve and display the 'Shipping Method' (i.e. Delivery or Collection etc.), that the customer had selected at the time of checkout, on the Order Confirmation page (i.e. after payment). I am trying to do this using get_post_meta($post_id, $key, $single) function. I am unable to do so as I don't know the $key value. I tried the following code (within php tag): echo get_post_meta( $order_id, 'shipping_method', true

WooCommerce change status for BACS orders based on specific shipping methods

淺唱寂寞╮ 提交于 2021-01-06 08:51:41
问题 How do I change the order status from on hold to my own custom status for a specific shipping method if the selected payment gateway is BACS? This is how I added my own custom status: // Register New Order Status add_filter( 'woocommerce_register_shop_order_post_statuses', 'register_custom_order_status' ); function register_custom_order_status( $order_statuses ){ // Status must start with "wc-" $order_statuses['wc-custom-status'] = array( 'label' => _x( 'Calculating Shipping', 'Order status',

WooCommerce change status for BACS orders based on specific shipping methods

☆樱花仙子☆ 提交于 2021-01-06 08:45:39
问题 How do I change the order status from on hold to my own custom status for a specific shipping method if the selected payment gateway is BACS? This is how I added my own custom status: // Register New Order Status add_filter( 'woocommerce_register_shop_order_post_statuses', 'register_custom_order_status' ); function register_custom_order_status( $order_statuses ){ // Status must start with "wc-" $order_statuses['wc-custom-status'] = array( 'label' => _x( 'Calculating Shipping', 'Order status',

Hide specific shipping method depending on day time in WooCommerce

不想你离开。 提交于 2021-01-01 06:53:45
问题 I'm looking to create a PHP code snippet that I would add to my functions.php file but I'm not sure how to proceed. Someone asked the same question 2 years ago (Woocommerce - disable certain shipping methods based on time of day) but finally opted for a plugin that does that. I already use add-ons for detailed delivery options and I don't want to change or add another one just for this simple function if something can be done easily with php. So I'm looking to disable a shipping method if the