woocommerce

if statement grouped products reference woocommerce

為{幸葍}努か 提交于 2021-02-10 09:25:22
问题 In my functions.php file I have some remove_actions and add_filters that run for woocommerce but the problem is these functions run for all woocommerce product types. I'd like to wrap a simple if statement around the hooks/filters I have to only run for grouped product pages the problem is I dont know how woocommerce refers to these pages heres what I have at the moment. remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); Heres what i'd like

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

Removing price suffix based on user role

五迷三道 提交于 2021-02-10 07:11:51
问题 Having failed at adding a suffix based on User Role because it wont display the Woo price display shortcode, I'm now approach the problem from the other direction - I have added the suffix to Woos tax tab, and now instead want to remove the suffix (from all user roles except one). I found this code on github to remove the suffix from products: add_filter( 'woocommerce_get_price_suffix', 'custom_woocommerce_get_price_suffix', 10, 2 ); function custom_woocommerce_get_price_suffix( $price

Removing price suffix based on user role

若如初见. 提交于 2021-02-10 07:06:53
问题 Having failed at adding a suffix based on User Role because it wont display the Woo price display shortcode, I'm now approach the problem from the other direction - I have added the suffix to Woos tax tab, and now instead want to remove the suffix (from all user roles except one). I found this code on github to remove the suffix from products: add_filter( 'woocommerce_get_price_suffix', 'custom_woocommerce_get_price_suffix', 10, 2 ); function custom_woocommerce_get_price_suffix( $price

Removing price suffix based on user role

坚强是说给别人听的谎言 提交于 2021-02-10 07:03:42
问题 Having failed at adding a suffix based on User Role because it wont display the Woo price display shortcode, I'm now approach the problem from the other direction - I have added the suffix to Woos tax tab, and now instead want to remove the suffix (from all user roles except one). I found this code on github to remove the suffix from products: add_filter( 'woocommerce_get_price_suffix', 'custom_woocommerce_get_price_suffix', 10, 2 ); function custom_woocommerce_get_price_suffix( $price

Removing price suffix based on user role

╄→гoц情女王★ 提交于 2021-02-10 07:03:40
问题 Having failed at adding a suffix based on User Role because it wont display the Woo price display shortcode, I'm now approach the problem from the other direction - I have added the suffix to Woos tax tab, and now instead want to remove the suffix (from all user roles except one). I found this code on github to remove the suffix from products: add_filter( 'woocommerce_get_price_suffix', 'custom_woocommerce_get_price_suffix', 10, 2 ); function custom_woocommerce_get_price_suffix( $price

Allow add to cart 3 products max for a specific product category in Woocommerce

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-10 06:41:36
问题 I am trying to send out a maximum of 3 free samples to customers with free shipping. I have created some 0 priced product and set them in "samples" product category. This specific products have option "sold individually" so customers can only have one of each sample. I cannot figure out how to allow only a maximum of 3 samples products from this product category on cart. Any help is appreciated. 回答1: This can be done easily using woocommerce_add_to_cart_validation action hook to limit

Replace the Variable Price range by the chosen variation price in WooCommerce 3

喜你入骨 提交于 2021-02-10 06:35:09
问题 On WooCommerce I would like to change the Variable single product page layout. Because, when you have an variable product you get this wired price rage ( below product title ) in the Variable Product page and it shows in the shop page as well. For me the standard way is to show the lowest price of the product in the shop as well as product page and change that price according to user selection of variables. I can't believe why. I can remove the price range and show the lowest price using this

WooCommerce custom shortcode product categories dropdown

天大地大妈咪最大 提交于 2021-02-10 06:27:06
问题 I am trying to add a WooCommerce categories-dropdown-shortcode, but this seems to not work. I am able to see the drop down, but when i choose a category it doesn't register and nothing happens. sc: [product_categories_dropdown orderby="title" count="0" hierarchical="0"] Code that's placed in my functions.php file <?php /** * WooCommerce Extra Feature * -------------------------- * * Register a shortcode that creates a product categories dropdown list * * Use: [product_categories_dropdown

Add new fields at the billing address woocommerce

 ̄綄美尐妖づ 提交于 2021-02-10 05:51:32
问题 I want to edit my billing address at my website, where i need to add and delete some others in my account page, which code shall I edit? Thank you in advanced 回答1: Can you please check below code you can add new custom field example. add_filter( 'woocommerce_billing_fields', 'custom_woocommerce_billing_fields' ); function custom_woocommerce_billing_fields( $fields ) { $fields['billing']['billing_options'] = array( 'label' => __('Custom Field', 'woocommerce'), // Add custom field label