How can I show variable variations to file content-product.php
-
Hi,
Please help me. I want to show available_variations in file single-product/add-to-cart/variable.php to file content-product.php.Code in file variable.php
<?php if ( empty( $available_variations ) && false !== $available_variations ) : ?> <p class="stock out-of-stock"><?php _e( 'This product is currently out of stock and unavailable.', 'woocommerce' ); ?></p> <?php else : ?> <table class="variations" cellspacing="0"> <tbody> <?php foreach ( $attributes as $attribute_name => $options ) : ?> <tr> <td class="label"><label for="<?php echo sanitize_title( $attribute_name ); ?>"><?php echo wc_attribute_label( $attribute_name ); ?></label></td> <td class="value"> <?php $selected = isset( $_REQUEST[ 'attribute_' . sanitize_title( $attribute_name ) ] ) ? wc_clean( stripslashes( urldecode( $_REQUEST[ 'attribute_' . sanitize_title( $attribute_name ) ] ) ) ) : $product->get_variation_default_attribute( $attribute_name ); wc_dropdown_variation_attribute_options( array( 'options' => $options, 'attribute' => $attribute_name, 'product' => $product, 'selected' => $selected ) ); echo end( $attribute_keys ) === $attribute_name ? apply_filters( 'woocommerce_reset_variations_link', '<a class="reset_variations" href="#">' . esc_html__( 'Clear', 'woocommerce' ) . '</a>' ) : ''; ?> </td> </tr> <?php endforeach;?> </tbody> </table>
Thank you very much
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How can I show variable variations to file content-product.php’ is closed to new replies.