buy button code to WordPress

Topic summary

Issue: A cart icon added via embed code appears only on the product page and doesn’t auto-update on other pages (archive, home) without a full refresh.

Cause: The code is likely scoped to the product page template, so it isn’t loaded site-wide.

Recommendations:

  • Site-wide display: Insert the cart icon code into the theme’s global header/navigation template so it renders on all pages.
  • Easier alternative: Use a Shopify cart icon app that automatically injects code across pages.
  • Real-time updates: Choose a solution that supports live cart updates via websockets (persistent connection for instant changes) or polling (periodic checks) to avoid page refreshes.

Notes: The suggestion comes from a PageFly (Shopify page builder) representative; the guidance centers on Shopify theme/app workflows.

Status: No confirmation of implementation or resolution; discussion remains open with clear next steps to try.

Summarized with AI on December 26. AI used: gpt-5.

The cart icon only shows on product page where I added the embed code but not showing on other page such as product archive pages or home page. Is there any html code I can add to other pages to show the cart icon?

I tried to add the same embed code to other page but the cart won’t auto-update. You have to refresh the whole page to show the updated cart. Please help!

Hi @DY92 ,
This is Theodore from PageFly - Shopify Page Builder App.

The cart icon code you added is likely specific to the product page template. To show it on all pages:

  1. (For developers) Edit your theme’s header/navigation template and inject the code there.
  2. (Easier option) Use a Shopify app for cart icons. These handle code injection and might offer real-time cart updates.

Automatic cart updates might require an app with features like websockets or polling.

Best regards,
Theodore | PageFly