• Resolved Juraj Hamara

    (@jurajj)


    Hi,
    I’m developing a custom Woocommerce theme.

    I have a single product with price and need to show under product summary something like product variations with links.
    This is what I need to do:

    View post on imgur.com

    Variable product only adds a select with no link to other products.
    Also var. product has no price, only his variations after selected options.

    Is there any way, how to do that? Tutorial or code snippet? I don’t want to use plugin if possible.

    Many thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hooks fire at various points in the product page and you can attach code to insert additional features. The principle is explained here:
    https://docs.woocommerce.com/document/introduction-to-hooks-actions-and-filters/

    You can see which hooks fire where with the guide on this page:
    https://hooks.wpdesk.org/product/tshirt/

    Unfortunately some themes disable some or all of the WooCommerce hooks and do their own thing, so you may need to look through your theme code to see how it works.

    PHP skills will be needed.

    Thread Starter Juraj Hamara

    (@jurajj)

    Very helpful. I have mentioned that I DEVELOP custom theme so I USE PHP AND WORDPRESS FRAMEWORK and have very good knowledge about hooks. My question was about something elses.

    Hi @jurajj,

    You could craft a function that displays the image for each variation probably using something like the woocommerce_after_add_to_cart_form or woocommerce_after_add_to_cart_button hooks. Then apply JavaScript to allow each image to select the correct variation.

    To get an idea of how to do that, there is a free plugin here at www.ads-software.com that uses images for variations this way. There’s also a paid one at https://woocommerce.com/products/variation-swatches-and-photos/

    I know you mentioned not wanting to use a plugin, but you could look through the code of the first one to get an idea of how someone has already created this.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Showing product variations with links’ is closed to new replies.