WooCommerce: Change template for single product page

Woo Commerce is off topic as its a plugin and not specifically related to WordPress but what you can do is copy over the single-product.php template to a WooCommerce folder in your child theme. change the file name and modify the file, then use single_template or template_include with the correct conditional tag. single_template function get_custom_post_type_template($single_template) … Read more

Woocommerce show cross sells on singe product page [closed]

add_action(‘woocommerce_after_single_product_summary’, ‘show_cross_sell_in_single_product’, 30); function show_cross_sell_in_single_product(){ $crosssells = get_post_meta( get_the_ID(), ‘_crosssell_ids’,true); if(empty($crosssells)){ return; } $args = array( ‘post_type’ => ‘product’, ‘posts_per_page’ => -1, ‘post__in’ => $crosssells ); $products = new WP_Query( $args ); if( $products->have_posts() ) : echo ‘<div class=”cross-sells”><h2>Cross-Sells Products</h2>’; woocommerce_product_loop_start(); while ( $products->have_posts() ) : $products->the_post(); wc_get_template_part( ‘content’, ‘product’ ); endwhile; // end of … Read more

Woocommerce: How to remove page-title at the home/shop page but not category pages

you can overwrite woocommerce template of “archive-product.php” into your current theme and replace with this code. <?php if ( apply_filters( ‘woocommerce_show_page_title’, true ) ) : ?> <?php if(!is_shop()) { ?> <h1 class=”page-title”><?php woocommerce_page_title(); ?></h1> <?php } ?> <?php endif; ?> For reference conditional tag of woocommerce OR <?php if ( apply_filters( ‘woocommerce_show_page_title’, true ) ) … Read more

how to override woocommerce specific loop or archive-product.php [closed]

The WooCommerce templating works in different ways depending on your needs and/or skills. The function: <?php wc_get_template_part(‘content’, ‘product’); is the WooCommerce equivalent of WordPress core template function: <?php get_template_part(‘filename’); It is important to know that this is the same as php require but without using .php extension at the end. Before you do any of … Read more

How to pass/get data to/from the WooCommerce data-product_variations object?

jQuery(document).on(‘found_variation.wc-variation-form’, ‘form.variations_form’, function(event, variation_data) { //this is called when a valid productis found }); jQuery(document).on(‘change.wc-variation-form’, ‘form.variations_form’, function(event) { //this function is called when the user clicks or changes the dropdown }); The PHP function you are looking for is apply_filters( ‘woocommerce_available_variation’, array( ‘attributes’ => $variation->get_variation_attributes(), ‘availability_html’ => wc_get_stock_html( $variation ), ‘backorders_allowed’ => $variation->backorders_allowed(), ‘dimensions’ => … Read more

WooCommerce prices location in DB

All the data like different prices of a product custom post type are store (for each product) in postmeta table. To find the post id of all products you have to use this query on posts table: SELECT * FROM ‘posts’ WHERE ‘post_type’ = ‘product’ For each product id (post_id), you can retrieve all related … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)