• Resolved leemon

    (@leemon)


    In PHP one can easily get the product placeholder image via the wc_placeholder_img() function. But, is there an equivalent function for Gutenberg blocks? I’m developing a custom WC block and I don’t know how to get this image via JS.

    Any ideas?
    Thanks in advance

Viewing 1 replies (of 1 total)
  • Mirko P.

    (@rainfallnixfig)

    Hi @leemon

    Thank you for reaching out on the WooCommerce support forum.

    In PHP one can easily get the product placeholder image via the?wc_placeholder_img()?function. But, is there an equivalent function for Gutenberg blocks??

    Regarding your question about getting the product placeholder image for Gutenberg blocks, there isn’t a direct equivalent function in JavaScript as there is in PHP with wc_placeholder_img(). However, you can try the following:

    1. Enqueue a JavaScript file in the plugin
    2. Pass the placeholder image URL from PHP to this JavaScript file using wp_localize_script() function.

    We don’t provide support for customizations on this forum. The following link may interest you if you need to consult a developer:

    https://woo.com/customizations/

    I hope these suggestions help you achieve your requirements.

    Best regards,

Viewing 1 replies (of 1 total)
  • The topic ‘Get the WC product placeholder image in a block’ is closed to new replies.