Support » Plugin: WooCommerce » Custom single-product.php template for a specific product?

  • Ok I have an online store at 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?

Viewing 1 replies (of 1 total)
  • Roy Ho


    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.
Viewing 1 replies (of 1 total)
  • The topic ‘Custom single-product.php template for a specific product?’ is closed to new replies.