Archive: Problems with Variable Products
-
Hello there,
today, I discovered two strange problems on the archive page of my shop, both related to variable products:
1. All variable products are displayed as “out of stock”, even though they are indeed stocked. (On the single product pages, the stock status is displayed correctly.)
2. The price (range)s of all variable products have disappeared from the archive page.
The shop in question: https://caffebarbera.de/shop/
(Quick Translation: “In den Warenkorb” = “Add to Cart”, “zurzeit vergriffen” = “temporarily out of stock”)
I am using WordPress v4.6, WooCommerce v2.6.4 and the (untouched!) theme “TwentyTwelve” v2.1 together with an accompanying child theme.
The following customizing has been done in the functions.php of my child theme:
/* WooCommerce: minimaler Preis statt Preisspanne */ add_filter('woocommerce_variable_price_html', 'custom_variation_price', 10, 2); function custom_variation_price( $price, $product ) { $price = ''; if ( !$product->min_variation_price || $product->min_variation_price !== $product->max_variation_price ) $price .= '<span class="from">' . _x('ab', 'min_price', 'woocommerce') . ' </span>'; $price .= woocommerce_price($product->min_variation_price); return $price; } /* Zeige-Details-Button */ add_action( 'woocommerce_after_shop_loop_item', 'my_woocommerce_template_loop_add_to_cart', 10 ); function my_woocommerce_template_loop_add_to_cart() { echo '<form action="' . get_permalink() . '" method="get"> <button type="submit" class="button add_to_cart_button product_type_simple">Details</button> </form>'; } /* WooCommerce: ähnliche Produkte ausblenden */ remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 ); /* Display x products per page */ add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 30;' ), 20 ); /* Produkt-Archiv: zurzeit leider nicht vorrätig */ add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_stock', 10); function woocommerce_template_loop_stock() { global $product; if ( ! $product->managing_stock() && ! $product->is_in_stock() ) echo '<p class="stock out-of-stock">z. Zt. leider nicht vorrätig</p>'; }Do you have any ideas/solutions? Thank you in advance!
Best
Leon
The topic ‘Archive: Problems with Variable Products’ is closed to new replies.