Product variant code


what is the way to insert dynamic product variant code inside an extra link on product page.

$product.product_code gives me the code of the first combination but if I change combination code does not change…

any idea?

{assign var=“obj_id” value=$product.product_id}

{assign var=“sku” value=“sku_$obj_id”}{$smarty.capture.$sku}

Like this it shows me dynamic product code… But how to insert it to the url?

May be this solution is not the best but it works for my needs at least. Normally it should be done via buttons…

As I only needed catalogue mode (allow empty URL marked) and I did not need any add to cart buttons

I did as follows:

in customer/common_templates/product_data.tpl


{capture name="sku_`$obj_id`"}
{if $show_sku}

{$lang.sku}: {$product.product_code}



{capture name="sku_`$obj_id`"}
{if $show_sku}




in customer/blocks/product_templates/default_template.tpl


{assign var="sku" value="sku_$obj_id"}{$smarty.capture.$sku}

from line 22

to button container as follows: (as you see I deleted all other buttons from this container as I do not need them):

{assign var=“sku” value=“sku_$obj_id”}{$smarty.capture.$sku}

Like this you will have dynamic link button based on product options code…

Of course should modify base.css and style.css according to your button design needs. In my case I used “button-submit-big” OR remove classes from spans and just keep it as a link…

If somebody have better approach, would be nice to see it.

Hi, do you have an URL where I can see this on a live/demo site? Maybe it is something I would like to use. Thank you.

Hi, if you want to see if it fits your needs and “Maybe it is something you would like to use” then you will need to test the code by yourself.


Before I mess around with code on my live shop it would be nice to see it in action where someone perhaps had already done it. That way it saves me some efforts messing around in the code of a live shop. By actually looking at it at a live website, I get a better idea of what it is you are talking about.

Thanks for the help, will try it myself.