product

Change markup in WooCommerce shortcode output

跟風遠走 提交于 2019-12-31 03:09:08
问题 Is it possible to use a WooCommerce shortcode e.g. [product_category category="appliances"] amending the markup to include a <div> tag around some elements? I know I can do this by duplicating what the shortcode does but that seems overkill just to add a wrapping <div> . I could do it with jQuery but don't want any delay in them loading. 回答1: @Updated Yes this is absolutely possible. You can achieve this with something like that: if( !function_exists('prod_cat') ) { function prod_cat( $atts )

Get variations IDs from a variable product in Woocommerce 3

混江龙づ霸主 提交于 2019-12-31 03:06:27
问题 It is necessary to get the value from the array with the key [0], but the array is in the object. How can I put it in a variable? WC_Product_Variable Object ( [children:protected] => Array ( [0] => 344 [1] => 345 ) [visible_children:protected] => Array ( [0] => 344 [1] => 345 ) 回答1: To get the children variation Ids for a variable product, use WC_product get_children() method (that doesn't have/allow any arguments) : // (if needed) Get an instance of the WC_product object (from a dynamic

Replace Add to cart button on Woocommerce Single Product Pages for a product category

 ̄綄美尐妖づ 提交于 2019-12-31 02:50:11
问题 I'm trying to add a custom link button that leads to Contact page - within first if condition that displays "Contact us" text with custom URL on the button instead of "Add to Basket" button. How to do that? This is my code so far. It shows custom button text for each product which is part of category "64". That's exactly what I want. But how to add that button changes function from cart button to custom link button? Im figuring If have to change this cart buttons function. How? add_filter(

Replace product “on backorder” to a custom field value in Woocommerce

允我心安 提交于 2019-12-31 02:50:07
问题 Firstly, thanks for viewing this question. I've searched and gone through many similar questions however i've not managed to find a perfect fix. Im setting up a website using wordpress/woocommerce, however most of our products have a set lead time therefore everything is on "back order - allow" status. Instead of showing "on backorder" on each product page, I wanted to see if it was possible to create a custom field in each product and replace the "on backorder" text to show that custom field

Include dimension letters L/W/H to WooCommerce formatted product dimensions output

徘徊边缘 提交于 2019-12-30 11:09:07
问题 I'm trying to modify dimensions output that everywhere where get_dimensions() is called instead of default it would include letter of dimension. So it would be 1 L x 1 W x 1 H instead of 1 x 1 x 1 Can I overwrite get_dimensions() function and include letter alongside each value in array or I can somehow use wc_format_dimensions() to do this? 回答1: Updated: You can't override get_dimensions() WC_Product method. But you can use woocommerce_format_dimensions filter hook located in wc_format

Include dimension letters L/W/H to WooCommerce formatted product dimensions output

我怕爱的太早我们不能终老 提交于 2019-12-30 11:09:03
问题 I'm trying to modify dimensions output that everywhere where get_dimensions() is called instead of default it would include letter of dimension. So it would be 1 L x 1 W x 1 H instead of 1 x 1 x 1 Can I overwrite get_dimensions() function and include letter alongside each value in array or I can somehow use wc_format_dimensions() to do this? 回答1: Updated: You can't override get_dimensions() WC_Product method. But you can use woocommerce_format_dimensions filter hook located in wc_format

Customize displayed products on Woocommerce Storefront home page

穿精又带淫゛_ 提交于 2019-12-30 10:59:15
问题 I have been rattling my brain over this far too long and I cannot find the solution, I have attempted plugins, to the woo commerce documentation and the storefront documentation but no success. The theme by default had a "New In" and "Best Sellers" where it listed 4 "New In" and 4 "Best Sellers" I want to increase the 4 "New In" to 8 so 2 rows of 4 columns and update the "Best Sellers" to a Random so different products show How can I achieve this? Example: https://etzeo.com/ 回答1: The

Enable Wholesale prices in Woocommerce 3

♀尐吖头ヾ 提交于 2019-12-30 10:34:42
问题 In wooCommerce, I have added a custom meta field with a custom price (wholesale price) in edit product pages settings. Everything works well. When I set a wholesale price it works fine everywhere. But if I try to change this wholesale price it doesn't work. the old price remains everywhere. What I am doing wrong? How can I solve this problem to allow wholesale price changes? The code I am using: function w4dev_get_wholesale_price( $product ) { if( $product->is_type( array('simple', 'variable'

Additional button in Woocommerce shop page and archives

大兔子大兔子 提交于 2019-12-29 09:13:13
问题 I'd like to add a button next to "Add to Cart" on the product page that adds "-sample" to the product URL when clicked. Example: You're viewing Product 1's page and the URL is " http://www.example.com/shop/product-1/ " When you click on the button, it adds "-sample" to the URL " http://www.example.com/shop/product-1-sample/ " How can I achieve this? Thanks 回答1: For woocommerce 3+ (only) : In woocommerce 3 you will use woocommerce_after_shop_loop_item action hook instead, as the hook

Add Attributes to Short Description in WooCommerce 3.0+

一曲冷凌霜 提交于 2019-12-29 08:22:40
问题 I would like to insert the attributes from all products to their short description, so the client can open a quickview and check this attributes. I already tried this answer: Display specific product attribute values on archives category pages Also this one: Woocommerce - Display single product attribute(s) with shortcodes in Frontend And I wasn't able to make it work. I think it should be because WooCommerce got updated to version 3.0+ Does anyone know a way to make it? Thanks 回答1: Update 3