• Resolved theamountof

    (@theamountof)


    I had products set up are variations before, but the client wanted each variation to be an individual product. When the products were variable and I went to the the single product page, it showed the price and would update the price if I selected one of the variations. Now that I have switched the products to be Simple Products, the price that was previously shown next to the add to car is no longer there.

    Where would I go about making it so that the price on a Simple Product shows up on the Single Product Page.

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

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    I don’t follow. Prices should show by default if set. For simple product you must set ‘regular price’.

    Thread Starter theamountof

    (@theamountof)

    I would agree, I have the regular price set, and it shows on the shop page, but not on the individual product page.

    https://www.onguardengineoil.com.php54-3.dfw1-2.websitetestlink.com/product/5w-30-premium-oil-synthetic-blend-single/

    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    Can you check another theme? Will narrow the problem.

    Thread Starter theamountof

    (@theamountof)

    Now I feel sheepish, I switched to the parent theme and the price showed up. I had done something in the child’s functions.php which is why the price was not showing up. I updated the functions.php and now they are showing up like they should, but is there a way to get the price to show up next to the Add to Cart instead of just below the title?

    Thread Starter theamountof

    (@theamountof)

    Also I created a custom field for the products so I could delineate the different products without having to make the titles even longer. On the shop page the custom field shows correctly, Single, 6 Pack, Case, etc but when on a single product page the related products show the custom field for the product it is on.

    I am using this code to the display the custom field:

    <?php
    global $wp_query;
    $postid = $wp_query->post->ID;
    echo get_post_meta($postid, 'amount', true);
    wp_reset_query();
    ?>

    Currently the only product with related products is the product I linked to previously.

    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    Don’t use wp_reset_query. Will break the loop.

    Thread Starter theamountof

    (@theamountof)

    I removed the wp_reset_query but when I am on a single product page the products under You may also like… still show the custom field for the main product on the page instead of the custom field for the other products.

    ie If I am on the 5w-30 Single (1 Quart) page, it is showing the 6 Pack and Case products under You may also like…, but For the 6 Pack and Case products the custom field shows Single (1 Quart)

    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    global $wp_query;
    $postid = $wp_query->post->ID;

    Why get the ID from that instead of the global $product?

    Thread Starter theamountof

    (@theamountof)

    I am not the best at coding php, and that is the code I found to display custom fields. So I changes $wp_query with $product and ended up with:

    <?php
    global $product;
    $postid = $product->post->ID;
    echo get_post_meta($postid, 'amount', true);
    ?>

    Which works and displays the correct custom field.

    Thank you!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Simple Single Product Price Missing’ is closed to new replies.