ການປ່ຽນປຸ່ມ Add to card ເປັນ ຊື້ດຽວນີ້

ການປ່ຽນປຸ່ມ Add to card ໃນເວບໄຊ້ທີ່ສ້າງຈາກ Wordpress ກໍລະນີໃຊ້ WooCommerce ໂດຍບໍ່ໃຊ້ Plugin ມີດັ່ງນີ້:

  1. ເຂົ້າຫຼັງບ້ານ Wordpress
  2. ເຂົ້າໄປທີ່ Appearance > Theme Editor ແລະເປີດ functions.php ຂື້ນມາ(ຖ້າໃຜໃຊ້Child themeກໍ່ແປງທີ່ child)
  3. ແລ້ວກ໋ອບປີໂຄດລຸ່ມນີ້ໃສ່(ໂຄດນີ້ສະແດງທັງpageແລະsingle product)
    // To change add to cart text on single product page
    add_filter( ‘woocommerce_product_single_add_to_cart_text’, ‘woocommerce_custom_single_add_to_cart_text’ );
    function woocommerce_custom_single_add_to_cart_text() {
    return ( ‘ຊື້ດຽວນີ້’, ‘woocommerce’ ); } // To change add to cart text on product archives(Collection) page add_filter( ‘woocommerce_product_add_to_cart_text’, ‘woocommerce_custom_product_add_to_cart_text’ ); function woocommerce_custom_product_add_to_cart_text() { return ( ‘ຊື້ດຽວນີ້’, ‘woocommerce’ );
    }
  4. ບັນທຶກ

ນອກຈາກນັ້ນກໍ່ຍັງສາມາດປ່ຽນປູ່ມອື່ນໆໄດ້

// To change add to cart text on single product page
add_filter( ‘woocommerce_product_single_add_to_cart_text’, ‘woocommerce_custom_single_add_to_cart_text’ );
function woocommerce_custom_single_add_to_cart_text() {
return __( ‘ຊື້ດຽວນີ້’, ‘woocommerce’ );
}

// To change add to cart text on product archives(Collection) page
add_filter( ‘woocommerce_product_add_to_cart_text’, ‘woocommerce_custom_product_add_to_cart_text’ );
function woocommerce_custom_product_add_to_cart_text() {
return __( ‘ຊື້ດຽວນີ້’, ‘woocommerce’ );
}

// To change heckout-button button
function woocommerce_button_proceed_to_checkout() { ?>

<?php
}

// To change placeed order
add_filter( ‘woocommerce_order_button_text’, ‘misha_custom_button_text’ );

function misha_custom_button_text( $button_text ) {
return ‘ຈ່າຍເງີນ’; // new text is here
}

// To change billing detail
function wc_billing_field_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case ‘Billing details’ :
$translated_text = __( ‘ລາຍລະອຽດໃບບິນ’, ‘woocommerce’ );
break;
}
return $translated_text;
}
add_filter( ‘gettext’, ‘wc_billing_field_strings’, 20, 3 );

SSL for business, from $12.88

Leave a Reply

Your email address will not be published. Required fields are marked *