product

Product regular price calculation based on 2 custom fields in Woocommerce 3

☆樱花仙子☆ 提交于 2021-02-19 03:05:10
问题 In Woocommerce I have set 2 custom fields in the admin in the pricing section under Woocommerce default prices fields: Margin rate and Purchase price. I am trying to figure out how can I auto update the product price (regular price field) based on the calculation below: $product_price = $rate_margin * $purchase_price; Any help is appreciated. 回答1: You should add alway add the code that is used for your additional pricing fields in your question. The code below is: displaying and saving 2

Display specific product attributes under product title in Woocommerce archive pages

倖福魔咒の 提交于 2021-02-18 18:19:33
问题 In woocommerce, I would like to show some product attributes on shop page under the product titles. This product attributes are "year", "model" and "oil". This is what I have for now: add_action('woocommerce_shop_loop_item_title', 'wh_insertAfterShopProductTitle', 15); function wh_insertAfterShopProductTitle() { global $product; $abv = $product->get_attribute('pa_year'); if (empty($abv)) return; echo __($abv, 'woocommerce'); } Any help is appreciated. 回答1: To display "year", "model" and "oil"

Display specific product attributes under product title in Woocommerce archive pages

≯℡__Kan透↙ 提交于 2021-02-18 18:18:48
问题 In woocommerce, I would like to show some product attributes on shop page under the product titles. This product attributes are "year", "model" and "oil". This is what I have for now: add_action('woocommerce_shop_loop_item_title', 'wh_insertAfterShopProductTitle', 15); function wh_insertAfterShopProductTitle() { global $product; $abv = $product->get_attribute('pa_year'); if (empty($abv)) return; echo __($abv, 'woocommerce'); } Any help is appreciated. 回答1: To display "year", "model" and "oil"

Disable add to cart button based on WooCommerce product custom stock status

假如想象 提交于 2021-02-16 20:00:11
问题 Currently in woocommerce, add to cart button disabled, if the stock status is out of stock . I add new stock status with the label Discontinued product by using woocommerce_product_stock_status_options , now I am looking for a way to treat this product like it is out of stock. Since I believe it is better to separate between a product that is not produced anymore and a product that produced and available in another store but it's not in stock. 回答1: You can use the following to disable add to

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

Move additional information from product tab under add to cart button in WooCommerce

谁都会走 提交于 2021-02-16 04:14:55
问题 In single product pages, I would like to change the location of "additional information" from tabs, under add to cart button using Woocommerce hooks (removing the "additional information" tab) . I have: add_action( 'woocommerce_product_additional_information', 'wc_display_product_attributes', 10 ); and: woocommerce_after_add_to_cart_button I'm trying: remove_action( 'woocommerce_product_additional_information', 'wc_display_product_attributes', 10 ); add_action( 'woocommerce_after_add_to_cart

Move additional information from product tab under add to cart button in WooCommerce

笑着哭i 提交于 2021-02-16 04:11:28
问题 In single product pages, I would like to change the location of "additional information" from tabs, under add to cart button using Woocommerce hooks (removing the "additional information" tab) . I have: add_action( 'woocommerce_product_additional_information', 'wc_display_product_attributes', 10 ); and: woocommerce_after_add_to_cart_button I'm trying: remove_action( 'woocommerce_product_additional_information', 'wc_display_product_attributes', 10 ); add_action( 'woocommerce_after_add_to_cart

Move additional information from product tab under add to cart button in WooCommerce

♀尐吖头ヾ 提交于 2021-02-16 04:09:46
问题 In single product pages, I would like to change the location of "additional information" from tabs, under add to cart button using Woocommerce hooks (removing the "additional information" tab) . I have: add_action( 'woocommerce_product_additional_information', 'wc_display_product_attributes', 10 ); and: woocommerce_after_add_to_cart_button I'm trying: remove_action( 'woocommerce_product_additional_information', 'wc_display_product_attributes', 10 ); add_action( 'woocommerce_after_add_to_cart

Hide payment method based on product type in WooCommerce

守給你的承諾、 提交于 2021-02-16 03:56:53
问题 In WoCommerce, I would like to disable particular payment methods and show particular payment methods for a subscription products in WooCommerce (and vice versa). This is the closest thing we've found but doesn't do what I am expecting. Yes, there are plugins that will do this but we want to achieve this without using another plugin and without making our stylesheet any more nightmarish than it already is. Any help on this please? 回答1: Here is an example with a custom hooked function in