Set up PCP to capture specific pack sizes from a product page with drop down selection

WP Intense Q & ASet up PCP to capture specific pack sizes from a product page with drop down selection
Humphrey asked 2 months ago

On a website there are multiple versions (different volume packs) that I am trying to offer comparisons on. The different pack sizes are identified from a drop down menu and the price is returned on the page. How do I set up PCP to scrape the prices for individual packs and populate the database in woocommerce?

It appears that all the prices are in the source code but what instructions can I give to PCP to differentiate between different prices for different packs?

1 Answers
Dave Hilditch Staff answered 2 months ago

If you examine the HTML you can see the structure for the prices. The page you privately linked shows 4 items in a radio box and it looks like this CSS would grab the prices for you:

.swatch-attribute-options .swatch-option[option-label="100ml"] .swatch-option__item-price-final

That will grab the 100ml price.

It’s not currently possible to get Price Comparison Pro to pull out all the variations from a page to populate the database. It’s only possible to scrape 1 product per page currently so I suggest you standardise on the 100ml bottles or something.

This example would make a good test case for a future upgrade – it would be great if you could create a feature request here on wpintense detailing what specifics you would like when scraping variations.

Humphrey G. replied 2 months ago

Thanks, not me being stupid then 🙂

Subscribe!

We publish performance optimisation guides regularly.

Subscribe so you never miss out.

We use cookies

We use cookies for various things on our site, including our on-site chat bubble (if you use it), our comment forms (if you use them) and for session handling (if you log in).

Other than that, we use cookies to identify where traffic came from to help us understand which traffic turns into sales, we use a cookie for Google Analytics traffic analysis and we use a cookie to customise adverts for our own products we think you'll be interested in.

You can read more detail in our privacy policy page. Please click 'Accept' or 'Decline' to continue.