Support » Plugin: WooCommerce Blocks » add to cart without image

  • Resolved Jon Brown

    (@jb510)


    Is there a way to use a WC Block to display just an add to cart button?

    I thought the “Hand Picked Product” block would work, but there doesn’t seem to be a way to turn off the thumbnail image.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Cara – a11n

    (@dcka)

    Hi Jon @jb510,

    You might be able to hide the image with CSS.

    Can you let us know more about what you’re trying to achieve though? That might allow us to look at other alternatives.

    Thread Starter Jon Brown

    (@jb510)

    Hi Cara,

    What I want is just a button linked to a product, that I can insert anywhere an have it add that product (a subscription) to the cart. What I currently do is manually create that link url (?add-to-cart=123) and apply it to a button.

    Not sure there is a block for that but seemed wired their isn’t a way to hide the image on the blocks that are available. Certainly don’t want to load the image on the Osage and then hide it with css.

    Plugin Support Adam a11n

    (@adamkheckler)

    You can use the Add To Cart shortcode for that:

    https://docs.woocommerce.com/document/woocommerce-shortcodes/#section-19

    For example, this shortcode:

    [add_to_cart id="12345" show_price="false"]

    … would create an “Add to cart” button for the product ID 12345, with the price hidden. The result is very simple, but should work for you. Screenshot:

    https://d.pr/i/hsnEXz/ulhd7p8JyW

    • This reply was modified 2 months, 3 weeks ago by Adam a11n.
    Thread Starter Jon Brown

    (@jb510)

    Thanks. I’m aware of those. I never use those because they’re hard to control styling on… which brings me back to wondering why a block, with style options, isn’t available for add-to-cart. I can’t stuff that shortcode in as a URL attribute on a button block.

    I know most of the blocks were migrations of old shortcodes it’s just odd to me this one didn’t get migrated. I thought maybe the intent was to consolidate (a lot of WC shortcodes were redundant and could have been merged into fewer WC Blocks).

    Anyway, sounds like there isn’t any new “Gutenberg friendly” way to do this. I’ll just use a button block and insert the url like I always have.

    An “Add to Cart” block is on our roadmap. No ETA yet.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.