Thứ Hai, 19/05/2025
Loading...
  • Login
Hoàng Giang Nam Blog
  • Home
  • WordPress
    • WordPress
    • Woocommerce
  • Windows
  • Office
  • Phần Mềm
  • Thủ thuật
  • Linux
    • Ubuntu
    • CentOS
    • VPS – Server
    • Web Server
No Result
View All Result
Hoàng Giang Nam Blog
  • Home
  • WordPress
    • WordPress
    • Woocommerce
  • Windows
  • Office
  • Phần Mềm
  • Thủ thuật
  • Linux
    • Ubuntu
    • CentOS
    • VPS – Server
    • Web Server
No Result
View All Result
  • Login
Hoàng Giang Nam Blog
No Result
View All Result
Home Wordpress Woocommerce
Delete custom field in database wordpress

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

admin by admin
01/01/2025
Share on FacebookShare on Twitter

Bắt buộc cài Plugin ACF

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

function add_custom_buttons() {
    global $product;

    // Danh sách nút bổ sung
    $buttons = [
        'shopee' => [
            'label' => 'Mua qua Shopee',
            'color' => '#ff7600',
            'hover_color' => '#ff8e2d',
            'field' => 'link_shopee',
        ],
        'lazada' => [
            'label' => 'Mua qua Lazada',
            'color' => '#464998',
            'hover_color' => '#5d61b9',
            'field' => 'link_lazada',
        ],
        'tiki' => [
            'label' => 'Mua qua Tiki',
            'color' => '#00b3fd',
            'hover_color' => '#46d4fe',
            'field' => 'link_tiki',
        ],
    ];

    // Lặp qua các nút và hiển thị
    foreach ($buttons as $key => $button) {
        $link = get_field($button['field']);
        if ($link) {
            echo '<style>
                .' . $key . '_button {
                    margin: 10px 0;
                    background-color: ' . $button['color'] . ';
                    border: none;
                    color: white;
                    padding: 5px 15px;
                    text-align: center;
                    text-decoration: none;
                    display: inline-block;
                    font-size: 16px;
                }
                .' . $key . '_button:hover {
                    background-color: ' . $button['hover_color'] . ';
                    color: white;
                }
            </style>';
            echo '<a class="' . $key . '_button" href="' . esc_url($link) . '" target="_blank">' . esc_html($button['label']) . '</a><br>';
        }
    }
}

 

admin

admin

Next Post
Delete custom field in database wordpress

Hiển Thị Giá Trị Custom Field - ACF

Please login to join discussion

Recommended.

Delete custom field in database wordpress

Hiển Thị Giá Trị Custom Field – ACF

01/01/2025

GG One 1năm

18/12/2024

Trending.

HuananZhi X79 / X99 Motherboard BIOS POST codes

HuananZhi X79 / X99 Motherboard BIOS POST codes

01/01/2025
Xóa, Sửa, Nâng dung lượng RAM ẢO – Swap trên Ubuntu

Xóa, Sửa, Nâng dung lượng RAM ẢO – Swap trên Ubuntu

01/01/2025
Tạo file IMG Windows.GZ bằng VM VirtualBox để cài đặt trên VPS Digitalocean, Linode

Tạo file IMG Windows.GZ bằng VM VirtualBox để cài đặt trên VPS Digitalocean, Linode

31/12/2024
Tăng / Giảm giá SALE toàn bộ cửa hàng, Xóa Giá Sale

Tăng / Giảm giá SALE toàn bộ cửa hàng, Xóa Giá Sale

01/01/2025

Cách tính số lần sạc của pin laptop Windows

19/12/2024
Hoàng Giang Nam

Blog chia sẽ kiến thức lập trình, source code, themes, plugin, phần mềm & thủ thuật máy tính...

Follow Us

Danh mục

  • CentOS
  • Chung
  • Server Email
  • Thủ thuật máy tính
  • Ubuntu
  • VPS – Server
  • Web Server
  • Windows
  • Woocommerce
  • Wordpress

Recent News

Disable Web Search Results in Windows 10/11 Start Menu

16/01/2025
Hướng dẫn lấy Client ID + Client Secret + Refresh Token Google Drive API

Hướng dẫn lấy Client ID + Client Secret + Refresh Token Google Drive API

19/12/2024
  • About
  • Advertise
  • Privacy & Policy
  • Contact

© 2024 Hoanggiangnam.com

No Result
View All Result
  • Home
  • Phần Mềm
  • Thủ thuật máy tính
  • WordPress
  • Ubuntu
  • Office
  • Photography
  • Windows

© 2024 Hoanggiangnam.com

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Click to Copy