Cafemmo Club
← Quay lại danh sách

Mình muốn liệt kê toàn bộ giá theo thuộc tính của từng sản phẩm

maxthieuchu27/11/2020877 lượt xem3 bình luận
Mình làm theo: https:// levantoan.com/thay-doi-cach-hien-thi-gia-cho-cac.../ Nhưng nó hiển thị giá của biến thể, tuy nhiên chỉ hiện giá biến thể, không hiển thị tên biến thể bác bác cho mình hỏi làm sao để hiển thị ạ Code: [CODE]function find_valid_variations() { global $product; $variations = $product->get_available_variations(); $attributes = $product->get_attributes(); $new_variants = array(); // Loop through all variations foreach( $variations as $variation ) { // Peruse the attributes. // 1. If both are explicitly set, this is a valid variation // 2. If one is not set, that means any, and we must 'create' the rest. $valid = true; // so far foreach( $attributes as $slug => $args ) { if( array_key_exists("attribute_$slug", $variation['attributes']) && !empty($variation['attributes']["attribute_$slug"]) ) { // Exists } else { // Not exists, create $valid = false; // it contains 'anys' // loop through all options for the 'ANY' attribute, and add each foreach( explode( '|\

Bình luận

Đang tải...

Đang kiểm tra đăng nhập...

Mình muốn liệt kê toàn bộ giá theo thuộc tính của từng sản phẩm · Cafemmo Club