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

Humphrey G. asked 3 years 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 3 years 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 3 years ago

Thanks, not me being stupid then 🙂

Your Answer

Super Speedy Plugins