variations

Display an estimated delivery date range based on WooCommerce cart item stock

走远了吗. 提交于 2020-01-12 09:51:12
问题 I am trying to output an estimated delivery date in the cart based on the stock status of the products in the cart. I was a little bit successful but now I am stuck. This is what I have written so far. It goes in the function.php function lieferzeit() { global $woocommerce; $cart_items = $woocommerce->cart->get_cart(); foreach ($cart_items as $variation) { $variation_id = $variation['variation_id']; $variation_obj = new WC_Product_variation($variation_id); $stock = $variation_obj->get_stock

Display an estimated delivery date range based on WooCommerce cart item stock

北城余情 提交于 2020-01-12 09:46:10
问题 I am trying to output an estimated delivery date in the cart based on the stock status of the products in the cart. I was a little bit successful but now I am stuck. This is what I have written so far. It goes in the function.php function lieferzeit() { global $woocommerce; $cart_items = $woocommerce->cart->get_cart(); foreach ($cart_items as $variation) { $variation_id = $variation['variation_id']; $variation_obj = new WC_Product_variation($variation_id); $stock = $variation_obj->get_stock

Show product variation in woocommerce Added to cart message

偶尔善良 提交于 2020-01-05 03:58:05
问题 In my WooCommerce store, when a variable product is added to cart I have the user stay on the product page. The success notice message shows the product title along with the generic appendage, but I want it to show the variations with the product title in notices like so: "Mens Coat - size: small“ has been added to your cart. Rather than: "Mens Coat“ has been added to your cart. Currently running WooCommerce 3.3.1 and WP 4.9. Thanks 回答1: This code is dynamic so will work for any number of

Display all products and variations on the shop page, while maintaining pagination

独自空忆成欢 提交于 2020-01-02 07:15:28
问题 I need to display every product, and in case it's a variable product (e.g. multiple colors), each variation on the shop page. At first, I've wrote my own query to retrieve all variations if the product had them: $product = get_product(); global $variable_id; global $color; if ($product->product_type == "variable") { $variations = $product->get_available_variations(); foreach ($variations as $variation) { $color = $variation["attributes"]["attribute_pa_colour"]; $variable_id = $variation[

Add Advanced Custom Fields to WooCommerce Product Variation

家住魔仙堡 提交于 2019-12-31 03:59:13
问题 I am using plugins called Advanced Custom Fields (ACF) and WooCommerce. I want to create a text and image field for WooCommerce product variation. I created fields in ACF and assigned them to "Post Type" > "product_variation" . But for I don't see these fields under product > Variations . I searched and it looks like I have to write a custom code to accommodate these fields. I tried searching the problem and most of the suggestions and tutorials I founds are about creating custom fields via

Using radio buttons and drop down selector at the same time for product variations

不羁的心 提交于 2019-12-25 07:26:32
问题 I am using the product variation like Height , Weight and Thickness . Before that all the variation attributes where displaying in drop down selectors. But now I am using woocommerce-radio-buttons plugin. This plugin convert dropdown into radio button. I want to convert only radio button for Height and Weight . But I don't want Thickness as radio button, because I need it as a drop down selector. How to do that? please suggest me. Thanks 来源: https://stackoverflow.com/questions/38912552/using

loop on attributes to create inventory variations

Deadly 提交于 2019-12-25 02:43:29
问题 I have this array of attributes for example: Array ( [0] => Array ( [id] => 20 [title] => Brown [parent_id] => 1 [parent_title] => Color [isMultiple] => 1 ) [1] => Array ( [id] => 21 [title] => Cream [parent_id] => 1 [parent_title] => Color [isMultiple] => 1 ) [2] => Array ( [id] => 61 [title] => S [parent_id] => 2 [parent_title] => Size [isMultiple] => 1 ) [3] => Array ( [id] => 62 [title] => M [parent_id] => 2 [parent_title] => Size [isMultiple] => 1 ) [4] => Array ( [id] => 63 [title] => L

Change product stock availability texts in Woocommerce

拟墨画扇 提交于 2019-12-24 11:46:04
问题 I am trying to change the in stock text next to the quantity available in woocommerce. I am using the stock management in product variations. I tried this code below: // change stock text add_filter( 'woocommerce_get_availability', 'wcs_custom_get_availability', 1, 2); function wcs_custom_get_availability( $availability, $variation ) { // Change In Stock Text if ( $variation->is_in_stock() ) { $availability['availability'] = __('Available!', 'woocommerce'); } // Change Out of Stock Text if (

WooCommerce displaying variable description after variable price

半世苍凉 提交于 2019-12-24 01:09:51
问题 I'm trying to display the variable description into a woocommerce product page. I installed a plugin named woocommerce radio buttons, for displaying my variable products and prices as a radio button instead of a select. I am editing the variable.php file, in this plugin (then I will transfer it to my child theme once finished) and basically I need to show the variable description into a label, as a variable named $variable_description. printf( '<div> <input type="radio" name="%1$s" value="%2

WooCommerce Variable Product notice Issue - please choose product options

无人久伴 提交于 2019-12-23 23:22:38
问题 I'm building an e-commerce site. I'm having some trouble with WooCommerce Variable Product . The "Add to Cart" button works fine with simple products, but does not work with variable products. It gives a "Please choose product options…" notice. I looked everywhere and tried several suggestions online, none of them work. So I looked into WooCommerce source file: class-wc-form-handler.php . In the function add_to_cart_handler_variable : function add_to_cart_handler_variable( $product_id ) {