/** * WhatsApp button in product archive */ add_action('woocommerce_after_shop_loop_item', 'add_a_custom_button', 5 ); function add_a_custom_button() { global $product; // Not for variable and grouped products that doesn't have an "add to cart" button if( $product->is_type('variable') || $product->is_type('grouped') ) return; // Output the custom button linked to the product echo '<div style="margin-bottom:10px;"> <a class="button custom-button" target="blank" href="https://api.whatsapp.com/send?phone=22222222&text=' . esc_attr( $product->get_title() ) . '">' . _('שלח ווטסאפ') . '</a> </div>'; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter