Thêm nút bổ sung Mua hàng qua Shopee , Tiki, Lazada

Bắt buộc cài Plugin ACF

/************************** Thêm nút bổ sung Shopee***************************/
add_action( 'woocommerce_after_add_to_cart_button', 'shopee_button_on_product_page', 30 );

function shopee_button_on_product_page() {
  global $product;
    $link = get_field('linkshopee');
    if( $link ): ?>
    <style>
        .shoppe_button {
            margin: 10px 0;
            background-color: #ff7600;
            border: none;
            color: white;
            padding: 5px 15px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 16px;
        }

         .shoppe_button:hover {
            background-color: #ff8e2d;
            color: white;
        }

    </style>
    <br><a class="shoppe_button" href="<?php echo esc_url( $link ); ?>" target="_blank">Mua qua Shopee</a>
    <?php endif;
}

/************************** Thêm nút bổ sung Lazada***************************/
add_action( 'woocommerce_after_add_to_cart_button', 'lazada_button_on_product_page', 30 );

function lazada_button_on_product_page() {
  global $product;
    $link = get_field('link_lazada');
    if( $link ): ?>
    <style>
        .lazada_button {
            margin: 10px 0;
            background-color: #464998;
            border: none;
            color: white;
            padding: 5px 15px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 16px;
        }

         .lazada_button:hover {
            background-color: #5d61b9;
            color: white;
        }

    </style>
    <a class="lazada_button" href="<?php echo esc_url( $link ); ?>" target="_blank">Mua qua Lazada</a>
    <?php endif;
}


/************************** Thêm nút bổ sung Tiki***************************/
add_action( 'woocommerce_after_add_to_cart_button', 'tiki_button_on_product_page', 30 );

function tiki_button_on_product_page() {
  global $product;
    $link = get_field('link_tiki');
    if( $link ): ?>
    <style>
        .tiki_button {
            margin: 10px 0;
            background-color: #00b3fd;
            border: none;
            color: white;
            padding: 5px 15px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 16px;
        }

         .tiki_button:hover {
            background-color: #46d4fe;
            color: white;
        }

    </style>
    <a class="tiki_button" href="<?php echo esc_url( $link ); ?>" target="_blank">Mua qua Tiki</a>
    <?php endif;
}

Leave a Reply