checkout

custom add to cart redirection for a defined product category in WooCommerce 3

ε祈祈猫儿з 提交于 2021-02-16 14:13:34
问题 On a WooCommerce website I would like to be redirect customers on checkout page just after a product is added to cart. However we want it to be for that specific product category instead of all the add to cart buttons. I have tried to look up past solutions but they either just crash my site when I update the functions.php or they are outdated and don't work anymore. I really appreciate any help. 回答1: Updated: Add to cart redirection will not work with ajax add to cart on shop and archives

custom add to cart redirection for a defined product category in WooCommerce 3

两盒软妹~` 提交于 2021-02-16 14:12:54
问题 On a WooCommerce website I would like to be redirect customers on checkout page just after a product is added to cart. However we want it to be for that specific product category instead of all the add to cart buttons. I have tried to look up past solutions but they either just crash my site when I update the functions.php or they are outdated and don't work anymore. I really appreciate any help. 回答1: Updated: Add to cart redirection will not work with ajax add to cart on shop and archives

How to make ship to different address checked when using Free Shipping and Flat Rate?

本秂侑毒 提交于 2021-02-11 12:01:43
问题 how can I make "Ship to a different address" checked when Free shipping or Flat rate is selected and Unchecked if Local pickup is selected. All I can see is either all 3 shipping methods are checked by default or not. Any advice would be much appreciated. Give thanks 回答1: Here is the way to show / hide checkout shipping fields (auto checking / unchecking "ship to different address" checkbox, based on the chosen shipping method. It will automatically show the shipping fields when the chosen

Restrict payment gateways based on taxonomy terms in WooCommerce checkout

妖精的绣舞 提交于 2021-02-10 18:50:27
问题 In my WooCommerce store I want to restrict and show payment gateway(cheque) only if the product has particular product category with the category ID "266". Now I have this snippet but it does the opposite - it disabled the gateway on the checkout for particular product category: add_filter( 'woocommerce_available_payment_gateways', 'bbloomer_unset_gateway_by_category' ); function bbloomer_unset_gateway_by_category( $available_gateways ) { if ( is_admin() ) return $available_gateways; if ( !

Restrict payment gateways based on taxonomy terms in WooCommerce checkout

家住魔仙堡 提交于 2021-02-10 18:49:09
问题 In my WooCommerce store I want to restrict and show payment gateway(cheque) only if the product has particular product category with the category ID "266". Now I have this snippet but it does the opposite - it disabled the gateway on the checkout for particular product category: add_filter( 'woocommerce_available_payment_gateways', 'bbloomer_unset_gateway_by_category' ); function bbloomer_unset_gateway_by_category( $available_gateways ) { if ( is_admin() ) return $available_gateways; if ( !

call shopify api Creating a checkout response variantid is invalid

蓝咒 提交于 2021-02-10 16:26:14
问题 i call api Creating a checkout the variant_id is 38894644552 is correct ,but this api response variantid is is invalid get my shop variant id get https://suisui.myshopify.com/admin/products/9981337608/variants.json Response: { "variants": [ { "id": 38894644552, "product_id": 9981337608,... Creating a checkout with variant id POST /admin/checkouts.json HTTP/1.1 Host: suisui.myshopify.com X-Shopify-Access-Token: xxx Content-Type: application/json { "checkout": { "lineitems": [ { "variantid":

WooCommerce: Set country by default in checkout page for unlogged users

浪尽此生 提交于 2021-02-10 07:34:52
问题 How to make the country default for regular (unregistered users). But if the buyer has a personal account and entered the country there, he would not be thrown into default in checkout? I have tried to use WooCommerce: Set country by default in checkout page answer, but it does work for all users logged in and guest… How to set the default country only for unregistered users? 回答1: Use is_user_logged_in() conditional tag as follows: add_filter( 'default_checkout_billing_country', 'change

Show subtotal excl. tax, add subtotal tax as separate row on Woocommerce checkout

ε祈祈猫儿з 提交于 2021-02-09 06:47:46
问题 Currently I have all my products set to include tax. Because of rules in my country I would like to have my subtotal without tax, then a line with the amount of tax being paid and then the total with all the taxes (which is already default) In my review-order.php the line <td><?php wc_cart_totals_subtotal_html(); ?></td> gets called. I would like to subtract the tax percentage (21%) from that so ( / 121 * 100). And then a new line which shows the full tax amount so (total - subtotal). 回答1:

Pre populate Woocommerce checkout fields

时间秒杀一切 提交于 2021-02-08 06:33:48
问题 I am trying to pre-populate additional fields in the woocommerce checkout page but I am struggling with it. add_filter('woocommerce_checkout_get_value', function($input, $key ) { global $current_user; switch ($key) : case 'billing_first_name': case 'shipping_first_name': return $current_user->first_name; break; case 'billing_last_name': case 'shipping_last_name': return $current_user->last_name; case 'billing_phone': return $current_user->phone; break; case 'billing_company': case 'shipping

Pre populate Woocommerce checkout fields

时间秒杀一切 提交于 2021-02-08 06:33:29
问题 I am trying to pre-populate additional fields in the woocommerce checkout page but I am struggling with it. add_filter('woocommerce_checkout_get_value', function($input, $key ) { global $current_user; switch ($key) : case 'billing_first_name': case 'shipping_first_name': return $current_user->first_name; break; case 'billing_last_name': case 'shipping_last_name': return $current_user->last_name; case 'billing_phone': return $current_user->phone; break; case 'billing_company': case 'shipping