• Hey guys! I’m using Woocommerce and am having some trouble. When clicking on a product in my products page, I am redirected to a page with the one product on it. I want to copy the html from that page so that I can reproduce the format on a different page, but am unable to find the page in the Page menu on my admin dashboard. Any ideas?

    https://www.ads-software.com/plugins/woocommerce/

Viewing 3 replies - 1 through 3 (of 3 total)
  • As i understand you want to reproduce different HTML format for another single product page.
    Assume there is “woocommerce” folder in your root theme directory.

    Create category XYZ and assign product from admin.Then copy content-single-product.php from woo commerce plugin folder to “woocommerce” in theme folder.
    and rename it with content-single-product-XYZ.php

    Copy single-product.php from plugin folder to “woocommerce” and edit its line 28 from:
    wc_get_template_part( ‘content’, ‘single-product’ );
    to
    $category = wp_get_post_terms( get_the_ID(), ‘product_cat’ );
    if ($category[0]->term_id == ‘term_id’)
    {
    woocommerce_get_template_part( ‘content’, ‘single-product-seperateCategory’ );
    }
    else
    {
    woocommerce_get_template_part( ‘content’, ‘single-product’ );
    }

    where term_id should be replace with term id of category XYZ.

    Thread Starter allenjaimie

    (@allenjaimie)

    What do you mean by assign product from admin?

    It means add product in woo commerce and select category XYZ before save the product.So product would assign to category XYZ.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Product Page’ is closed to new replies.