Skip to content

Instantly share code, notes, and snippets.

@tuongpgjz
Last active November 13, 2021 16:16
Show Gist options
  • Save tuongpgjz/70bf5bccda77a79b11758cca8de74452 to your computer and use it in GitHub Desktop.
Save tuongpgjz/70bf5bccda77a79b11758cca8de74452 to your computer and use it in GitHub Desktop.
Add popup sizechart from UX Block in flatsome theme - salesgen.io
<?php
// Snippet by https://SalesGen.io
//display sizechart above add to cart button
// #1 put this code in to functions.php of your themes/child theme
// #2 create UX block with ID : sizechart.
// #3 Check your product page
//Notice: Change the width of popup on desktop by change the 800px with your expect value
add_action('woocommerce_before_add_to_cart_quantity', 'salesgen_size_chart');
function salesgen_size_chart() {
?>
<div class="sg_size_chart_wrp">
<a href="#lightboxsizechart" target="_self" class="button primary button primary is-underline">
<span>Size chart</span>
</a>
<?php echo do_shortcode( '[lightbox width="800px" id="lightboxsizechart"][block id="sizechart"][/lightbox]' );?>
</div>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment