{"id":19009941,"date":"2026-09-02T17:41:25","date_gmt":"2026-09-02T17:41:25","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/incorrect-swatch-location-on-more-complex-layouts\/"},"modified":"2026-09-02T17:41:25","modified_gmt":"2026-09-02T17:41:25","slug":"incorrect-swatch-location-on-more-complex-layouts","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/incorrect-swatch-location-on-more-complex-layouts\/","title":{"rendered":"Incorrect swatch location on more complex layouts"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hello!<br \/><br \/>You are using the <code>woocommerce_single_product_summary<\/code> hook with different priority values to control the swatch placement. While this works for basic themes that use the default WooCommerce template, it&#8217;s not a good solution. More advanced themes, like Blocky, use custom templates and provide multiple content blocks that can be reordered from the Customizer. Other plugins can also extend these templates.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Because you use the same hook for everything, just with a different priority, the swatches do not display in the correct location on more advanced layouts when the Position is set to either Above or Below the Add to Cart button.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To fix this, please edit your <code>class-linked-variation.php<\/code> file and replace the lines below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if( 'above_the_add_to_cart_button' === $alv_settings_positions ){<br \/>    $this-&gt;loader-&gt;add_action( 'woocommerce_single_product_summary', $plugin_admin, 'show_link_variations', 25 );<br \/>}<br \/>if( 'under_the_add_to_cart_button' === $alv_settings_positions ){<br \/>    $this-&gt;loader-&gt;add_action( 'woocommerce_single_product_summary', $plugin_admin, 'show_link_variations', 35 );<br \/>}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">with this new code snippet:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if( 'above_the_add_to_cart_button' === $alv_settings_positions ){<br \/>    $this-&gt;loader-&gt;add_action( 'woocommerce_before_add_to_cart_form', $plugin_admin, 'show_link_variations', 5 );<br \/>}<br \/>if( 'under_the_add_to_cart_button' === $alv_settings_positions ){<br \/>    $this-&gt;loader-&gt;add_action( 'woocommerce_after_add_to_cart_form', $plugin_admin, 'show_link_variations', 5 );<br \/>}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">By using the proper hooks, the swatches will display correctly across all themes, including those with custom templates or extended by third-party plugins.<\/p>\n","protected":false},"template":"","class_list":["post-19009941","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19009941","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19009941\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=19009941"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}