what happens when you add an item to the cart?
No cart appears – the product page only shows the text content.
My ‘theme’ is a single file and the entire main content area is as below. I have no idea if anything special is needed to display your widget (again, Shipping Rates table shows correctly).
<!– S T A R T M A I N C O N T E N T –>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class=”post”>
<h3 class=”storytitle” id=”post-<?php the_ID(); ?>”>” rel=”bookmark”>
<?php the_title(); ?>
</h3>
<div class=”storycontent”>
<?php the_content(__(‘(more…)’)); ?>
</div>
</div>
<div align=”center”>
<img src='<?php bloginfo(‘template_directory’); ?>/images/postend.gif’>
</div>
<?php endwhile; else: ?>
<p>
<?php _e(‘Sorry, no posts matched your criteria.’); ?>
</p>
<?php endif; ?>
<h3>
<?php posts_nav_link(‘ — ‘, __(‘« Previous Page’), __(‘Next Page »’)); ?>
</h3>
<!– E N D M A I N C O N T E N T –>
so your posts/pages with product info aren’t showing the add to cart form? or are they?
on the pages edit screen is there a shopping cart page showing?
Posts do not show the cart form.
Post Edit screen shows the ‘Product Entry’ section with everything set and both ‘Featured’ and ‘Stock Available’ checkboxes ticked.
can you try using one of the default themes. If that works its a problem with your theme.
Hi Elfin,
Yes, as in my first post… it works fine with the default theme.
I can’t see anything obviously different in my Main Content area (shown above). I can’t figure out what else I have to do to make my theme ‘widget-enabled’.
oh sorry – the widgets are separate, the add to cart is added to the content of the page. This has nothing to do with widgets.
I hook onto the_content (by using an add_filter), which I see in your code above, so I have no idea why it isn’t working for you.
You could try changing the eShop setting:
Product Listings
Show add to cart forms on WordPress post listings.
to yes,
and see if that fixes it. However this option generally adds the form all over the place, so it is really only a temporary solution.
Thanks Elfin,
After your comment, I tried changing:
<?php the_content(__(‘(more…)’)); ?>
to:
<?php the_content(‘(more…)’); ?>
which was a small difference that I don’t understand but it had no effect.
After setting ‘Show add to cart forms on WordPress listings’ to YES,
the Cart Form appears and seems to work okay. I can’t see any obvious problems and the form only appears on product pages.
I don’t know if this is safe to go live with ?!?
probably slightly malformed… I think.
Don’t see why not. But upgrade to 5.2.2, there was a major issue with 5.2.1 that stopped people at checkout.