请使用以下代码段。它将在“添加到购物车”按钮之后添加一个新按钮。代码注释很好,希望对您有所帮助。
add_action( \'woocommerce_after_add_to_cart_button\', function() {
/**
* If you need product data here you can set $product as global
* then you can easily access product data through $product object
*
* global $product;
*/
/**
* You may have to build product customization link automatically
* if the customization link follows same pattern and has product
* id then you can store the customization product id in product meta
* and retrive that meta using $product->get_meta( \'_customization_id\' );
*/
$builder_product_link = \'http://builder.alltype.com/\';
?>
<a class="button" href="<?php echo esc_url( $builder_product_link ); ?>"><?php esc_html_e( \'Customize Product\', \'text-domain\' ); ?></a>
<?php
} );