2
WooCommerce 3.0 이상을 사용하고 있으며 특정 페이지에서 제품 가격을 설정했습니다.WooCommerce 3.0 이상의 주문에서 동적 카트 항목 가격이 책정되지 않습니다
$regular_price = get_post_meta($_product->id, '_regular_price', true);
$buyback_percentage = get_post_meta($_product->id, '_goldpricelive_buy_back', true);
$fixed_amount = get_post_meta($_product->id, '_goldpricelive_fixed_amount', true);
$markedup_price = get_post_meta($_product->id, '_goldpricelive_markup', true);
$buyback_price = ($regular_price - $fixed_amount)/(1 + $markedup_price/100) * (1-$buyback_percentage/100);
$_product->set_price($buyback_price);
내 장바구니에서 가격이 업데이트되고 있지만 주문 제출을 클릭하면 주문 개체가 설정 한 가격을받지 못하는 것 같습니다. 원산지 제품 가격이 소요됩니다.
이 작업을 어떻게 수행 할 수 있습니까? 당신이 사용자 정의 후크 함수 내에서 woocommerce_before_calculate_totals
액션 후크 설정을 사용해야
감사
get_price()
방법으로 업데이트
어떻게 이러한 모든 코드 라인을 호출합니까? – Reigel
나는 루프를 통해 이것을 호출한다. $ _product = wc_get_product ($ id) – Elland
잘,'$ _product-> set_price ($ buyback_price);'는'$ _product' 바로 지금 바로 가격을 정할 것이다. 그것은 구원을 얻지 못할 것이다. – Reigel