Custom single-product.php template for a specific product? (2 posts)

  1. ronaldfuquay
    Posted 2 years ago #

    Ok I have an online store at http://www.tapsbus.com where we sell fares and passes. The stock single-product.php template works well for these products.

    However, I am trying to add an airport shuttle service product that uses the gravity forms extension to the store and I need a custom template for that specific product. The stock template crams the form to the right to make room for an image and I want the form to take up the content area and do not need the image.

    I have been able to fix this using two methods; through css as well as adding the following code to functions.php
    remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 );

    The only issue is that both solutions above affect all products. my attempts at creating conditional php or condition css have failed.

    Can anyone help me with this?


  2. Roy Ho
    Posted 2 years ago #

    Well if you already have a working solution and just need to wrap a conditional around it, you can always use the trusted post global.

    global $post;
    // assume your product id is 1255
    if ( $post->ID === 1255 ) {
         // do your special code here.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.