• Hey folks, I’m the dev for the EWWW Image Optimizer, and we’ve had a lot of folks request integration with your product variations and our JS-based WebP rewriter.

    However, I’m running into a bit of a road block with the image URLs that are in a JSON object attached via the data-product_variations attribute on form.variations_form.

    Short of trying to un-escape and then decode the JSON with PHP (after grabbing it with a regex…), it would be much easier to parse the original array before it gets JSON encoded (in templates/single-product/add-to-cart/variable.php). I couldn’t find any suitable filters already in the code, so I’m wondering if it would be possible to have one added in a future release?

    Thanks for your time!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Riaan K.

    (@riaanknoetze)

    Hey there!

    Thanks for getting in touch and proposing a closer integration 🙂

    I couldn’t find any suitable filters already in the code, so I’m wondering if it would be possible to have one added in a future release?

    Sounds perfectly reasonable! The easiest way to get that added is by adding the exact filter you’re looking for in a pull request on the Github repo at https://github.com/woocommerce/woocommerce. That way, you’ll be able to get in touch with our devs directly and you get to make sure it’ll work for your needs exactly 🙂

    Thread Starter Shane Bishop

    (@nosilver4u)

    Alright, I’m working on a pull request, and will submit it once I get a chance to test and make sure it does what we need. Thanks!

    Thread Starter Shane Bishop

    (@nosilver4u)

    One last question (let me know if this question goes on GitHub):
    I’m wondering what this particular URL is for, and if it needs to be converted to WebP:
    $available_varions[$x][image][url] => https://example.shanebishop.net/wp-content/uploads/2020/06/IMG_0756.jpg

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘filter product variations JSON’ is closed to new replies.