Woocommerce 관련 제품 템플릿에 의해 관련 제품을 주문은에 있습니다 :WooCommerce 판매 사용자 정의 계산
/wp-content/plugins/woocommerce/templates/single-product/related.php
그러나 임의하여 현재 순서.
나는 'total_sales' + 'sales_count'
으로 (사람들이 2 meta_keys 정수 값을 보유하고 'sales_count'
하는 추가 사용자 정의 필드) 것을 주문하고 싶습니다. 여기
$args = apply_filters('woocommerce_related_products_args', array(
'post_type' => 'product',
'ignore_sticky_posts' => 1,
'no_found_rows' => 1,
'posts_per_page' => 4,
'orderby' => 'total_sales',
'order' => 'DESC',
'post__in' => $related
));
$products = new WP_Query($args);
하지만 난 TOTAL_SALES 및 sales_count의 합계를 사용하여 해당 정렬 할 필요가?
이 방법이 있습니까? 이미 판매 된 모든 항목의 계산을 만드는 제품에 대한 기본 'total_sales'
으로 내가 $soldty = get_post_meta($product->id, 'sales_count', true);
의 잘 목적을 이해하지 못하는
감사
죄송합니다. 두 개의 사용자 정의 필드의 합계로 주문해야하는 정보가 더 필요합니다. 다른 매개 변수는 정상입니다. –
고객이 주문을했을 때 wocommerce로 total_sales 값이 증가합니다. sales_count 사용자 정의 필드가 추가되었습니다. 또한 일부 정수를 유지하면 sales_count의 사용은 제품 페이지 sales_count + total_sales에 표시하는 데 사용됩니다.제품에 실제 판매량이 없으므로 sales_count 필드를 사용하여 일부 판매가 표시됩니다. –
$ units_sold = get_post_meta ($ product-> id, 'total_sales', true); $ soldty = get_post_meta ($ product-> id, 'sales_count', true); 'Sales :'. ($ units_sold + $ soldty); –