checkout

Show/hide shipping methods based on a WooCommerce checkout field value

大城市里の小女人 提交于 2020-02-02 05:34:25
问题 In WooCommerce, I have set different shipping methods , but one in particular must be exclusive for companies. For this I am using the following code: add_filter( 'woocommerce_package_rates', array( $this, 'package_rates' ), 10, 2 ); public function package_rates( $rates, $package ) { $company_rate_id = 'flat_rate:7'; if(!empty(WC()->customer->get_billing_company())){ $company_rates = $rates[ $company_rate_id ]; $rates = array( $company_rate_id => $company_rates ); }else{ unset( $rates[

virtuemart 3.0.10 disable double confirmation on checkout

萝らか妹 提交于 2020-01-25 12:50:07
问题 There is solution. In my sites on virtuemart I manually (with code editing) do one page checkout (and one step). But after version 3.0.10 my solution no longer work. Before version 3.0.10 I used follow method: In cart/tmpl/default.php in bottom of file present hidden inputs. After <input type='hidden' name='task' value='updatecart'/> add <input type='hidden' name='task' value='confirm'/> . And it works. But after version 3.0.10 I found no other option except hack of virtuemart core: In cart

Python auto checkout with requests

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-25 08:17:00
问题 I’m trying to buy a product on the website, with a requests python’s library. For keep the cookies in the session i’m using requests.Session() and all the post requests are made with the most common headers.I’m using dev tools for reproduce the POST requests and converter it from curl to python with trillworks.com, but at the payment page i got: the cart content is changed (obv it pisn’t). My questions are: -It’s enough make a POST requests?(i’m doing in this way) -i’m reproducing only xhr

Python auto checkout with requests

穿精又带淫゛_ 提交于 2020-01-25 08:16:07
问题 I’m trying to buy a product on the website, with a requests python’s library. For keep the cookies in the session i’m using requests.Session() and all the post requests are made with the most common headers.I’m using dev tools for reproduce the POST requests and converter it from curl to python with trillworks.com, but at the payment page i got: the cart content is changed (obv it pisn’t). My questions are: -It’s enough make a POST requests?(i’m doing in this way) -i’m reproducing only xhr

Shipping costs and restrictions based on location and product category in WooCommerce

霸气de小男生 提交于 2020-01-24 21:54:27
问题 I'm using Woocommerce and I'd like to restrict the shipping class 'alcoholics' and allow it just for just Italy and no other countries, can you help me with this code? Thank you very much for your help! function( $is_available ) { $cart_items = WC()->cart->get_cart(); foreach ( $cart_items as $cart_item ) { $product = $cart_item['data']; $class = $product->get_shipping_class(); if ( $class === 'alcoholics' ) { return false; } } return $is_available; } add_filter( 'woocommerce_states', 'AL

WooCommerce dynamic minimum order amount based fee

岁酱吖の 提交于 2020-01-23 11:53:26
问题 I need to set a minimum order fee in the shopping cart so if products in the cart don't total more than £10 then an extra fee is applied to bring the price up to £10. Here is the code I have at the moment which works well in the cart phase however when you reach the checkout the pricing section doesn't stop loading for some reason and you can't checkout, can anyone help? Code from functions.php: function woocommerce_custom_surcharge() { global $woocommerce; if ( is_admin() && ! defined(

Shipping calculated on cart items weight and cart amount

跟風遠走 提交于 2020-01-21 10:05:06
问题 In a client WooCommerce web site, free shipping method is enabled for orders amount up to 250. I use the code below (from this answer) , to hide other shipping rates when the order amount is over 250, except when there is heavy items in cart. add_filter( 'woocommerce_package_rates', 'conditionally_hide_other_shipping_based_on_items_weight', 100, 1 ); function conditionally_hide_other_shipping_based_on_items_weight( $rates ) { // targeted weight $target_product_weight = 12; $target_cart_amount

BigCommerce - Custom Shipping Method (RoyalMail Widget for Collect Location)

狂风中的少年 提交于 2020-01-16 15:52:26
问题 I would like to setup custom shipping option using RoyalMail collect widget so customer can go through widget and it would return address after customer selection. So we need to map those address fields with customer shipping address fields. I have tried with checkout-js-sdk but it required considerable effort to create customm checkout from scratch. I am aiming to have a solution to map widget with BigCommerce shipping method using JavaScript or Angular Js. window.language = {{ langJson

WooCommerce Free Shipping - Remove raw or change the text name on checkout and email

烈酒焚心 提交于 2020-01-14 05:00:09
问题 I am running WooCommerce 2.6.2 on WP 4.5.3 and Sydney template. On the WooCommerce Checkout Page (Order completed) under Order Details, I want to Change the 'Free Shipping' text to something else, or remove this row. I ALSO want to change or remove this row from the Emails sent to the Customer. However, I can't get this text to Translate I've added this to my functions.php // Add this to your functions.php add_filter('gettext', 'translate_reply'); add_filter('ngettext', 'translate_reply');

Display billing and shipping fields in “Pay to order” page Woocommerce

感情迁移 提交于 2020-01-14 03:52:10
问题 When I create a custom order for clients, they have to pay it in their account. But when they access to the order pay page, no shipping and billing fields is showing. How to do it ? I know that the template is form-pay.php Thanks 回答1: Add this to your theme's 'woocommerce/checkout/form-pay.php'. <!-- Display Information --> <h2 class="woocommerce-column__title"><?php esc_html_e( 'Billing address', 'woocommerce' ); ?></h2> <address> <?php echo wp_kses_post( $order->get_formatted_billing