woocommerce

Charge a conditional Delivery fee in WooCommerce 3

一世执手 提交于 2021-02-08 09:01:05
问题 This is my condition like: If subtotal <= certain amount && subtotal <= certain amount So if the subtotal matches this criteria then I want to charge a delivery fee which should also show in the email invoice. Currently this is my code: add_action( 'woocommerce_cart_calculate_fees','my_delivery_fee' ); function my_delivery_fee() { global $woocommerce; if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return; $subtotal = $woocommerce->cart->subtotal; if(subtotal <= certain amount && subtotal <=

WooCommerce promotional discount: Buy 10 Get 1 Free

守給你的承諾、 提交于 2021-02-08 08:36:16
问题 I'm trying to set up a specific discount for three variable products (464, 465 and 466). If a customer buys ten products they get one for free. Based on WooCommerce discount: buy one get one 50% off answer code, I've come up with the following code: add_action('woocommerce_cart_calculate_fees', 'add_custom_discount_11th_at_100', 10, 1 ); function add_custom_discount_11th_at_100( $wc_cart ){ if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return; $discount = 0; $items_prices = array(); // Set

Output product custom field values in order email notification

懵懂的女人 提交于 2021-02-08 08:36:10
问题 I have a custom field for a Woocommerce's product, and I want to display it's value in order emails. As I'm using custom product submission form, I added this code for custom field below to create a custom field: <?php WCVendors_Pro_Form_Helper::select( array( 'post_id' => $object_id, 'class' => 'select2', 'id' => 'wcv_custom_product_ingredients', 'label' => __( 'What time?', 'wcvendors-pro' ), 'placeholder' => __( 'Pick a time', 'wcvendors-pro' ), 'wrapper_start' => '<div class="all-100">',

woocommerce not able to generate new API Key - JS error

拟墨画扇 提交于 2021-02-08 08:23:16
问题 I am trying to generate new API Keys in latest woocommerce plugin to use for REST API. But there is an error on woocommerce >> settings >> API >> Generate Key button and that not getting submitted. So, How to get rid of this error and how to get my consumer and secret key. 回答1: Resolved, Just by commenting the code at line no. 31 and set "return true" in wp-content/plugins/woocommerce/assets/js/admin/api-keys.js?v‌​er=3.2.6 see the code 来源: https://stackoverflow.com/questions/48282061

woocommerce not able to generate new API Key - JS error

半世苍凉 提交于 2021-02-08 08:22:20
问题 I am trying to generate new API Keys in latest woocommerce plugin to use for REST API. But there is an error on woocommerce >> settings >> API >> Generate Key button and that not getting submitted. So, How to get rid of this error and how to get my consumer and secret key. 回答1: Resolved, Just by commenting the code at line no. 31 and set "return true" in wp-content/plugins/woocommerce/assets/js/admin/api-keys.js?v‌​er=3.2.6 see the code 来源: https://stackoverflow.com/questions/48282061

Changing specific order details text in Woocommerce order received page

人走茶凉 提交于 2021-02-08 08:21:30
问题 On the order-recieved page (' woocommerce_thankyou ') there is a table with the order details a heading "Order Details" ( Ordredetaljer in my native language). I cannot figure out how to change this heading. I can't even find the source code for it properly. If someone could tell me the string(We use wpml for string translation) or the source code I would be a happy developer. 回答1: The template you are looking for is located in order/order-details.php But as WooCommerce templates doesn't seem

Change product price when product attribute has an additional price (WooCommerce)

这一生的挚爱 提交于 2021-02-08 08:18:11
问题 For one of my webshops im trying to achieve the following: All of the products in the webshop have variations. For example Product X can be ordered in the color RED but also in the color BLACK. Now im trying to set an additional price in WooCommerce for example the color Black. Color RED - No additional costs Color Black- Additional cost €30 How can i set this additional cost in WooCommerce? I can only set a total price for a product variation. How can i display these additional costs in the

Change product price when product attribute has an additional price (WooCommerce)

橙三吉。 提交于 2021-02-08 08:17:04
问题 For one of my webshops im trying to achieve the following: All of the products in the webshop have variations. For example Product X can be ordered in the color RED but also in the color BLACK. Now im trying to set an additional price in WooCommerce for example the color Black. Color RED - No additional costs Color Black- Additional cost €30 How can i set this additional cost in WooCommerce? I can only set a total price for a product variation. How can i display these additional costs in the

Can't Change WooCommerce Coupon Label In Cart Totals

十年热恋 提交于 2021-02-08 07:59:24
问题 This has proven to be a challenge I can't figure out. I handled the renaming of "Coupon" to "Promo" pretty much everywhere else. However, the renaming of the WC LABEL that calls the name of the coupon and the LABEL is a lot harder. Here's a screenshot of what I'm talking about exactly: I've pretty much renamed all the uses of "coupon" to "promo" site-wide. This one is making my hair fall out. Has anyone ever successfully changed this? What am I missing? Rename "Coupon" to "Promo" code below /

Shipping options depending on cart weight and shipping class

会有一股神秘感。 提交于 2021-02-08 07:51:19
问题 I am working on a WordPress site that uses WooCommerce. I found this piece of code that allows me to set a freight shipping option based on weight. It worked great until the client also wanted the same freight shipping option if a freight shipping class is selected on a product. add_filter( 'woocommerce_package_rates', 'bbloomer_woocommerce_tiered_shipping', 10, 2 ); function bbloomer_woocommerce_tiered_shipping( $rates, $package ) { if ( WC()->cart->cart_contents_weight < 300 ) { if ( isset(