programing

WooCommerce 주문 합계 가져오기

lastcode 2023. 3. 13. 20:32
반응형

WooCommerce 주문 합계 가져오기

현재 구글 애드워즈 변환으로 발송할 수 있도록 WooCommerce 체크아웃의 총 오더를 받고 있습니다.

코드는 다음과 같습니다.

<?php
$get_order_total = floatval( preg_replace( '#[^\d.]#', '', $order->get_formatted_order_total() ) );
?>

<!-- Google Code for ATS Conversion Page -->
<?php if ( $get_order_total ) { ?>
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 1066553725;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "CzWXCLmwn1YQ_aLJ_AM";
if (<?php echo $get_order_total; ?>) { var google_conversion_value = <?php echo $get_order_total; ?>; var google_conversion_currency = "GBP"; }
var google_conversion_currency = "GBP";
var google_remarketing_only = false;
 /* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/1066553725/?value=<?php echo $get_order_total; ?>&amp;currency_code=GBP&amp;label=CzWXCLmwn1YQ_aLJ_AM&amp;guid=ON&amp;script=0"/>
</div>
</noscript>

<?php } ?>

어떤 이유로 페이지 $get_order_total = floatval ( preg _ replace ( ' # [ ^ \ d . ]# , ' , $order - > get _ > get _ order _ order _ total ) ) it and and and and the the the the the the the:::::::::: the: 。

/woocommerce/checkout/thankout의 비오브젝트 멤버 함수 get_formated_order_total()을 호출합니다.409행의 php

둘러보고 글로벌 $woocommerce 변수를 추가하려고 했지만 성공하지 못했습니다.사용하고 있는 버전은 2.1.12 입니다.

잘 부탁드립니다.

이미 에 액세스 할 수 있는 경우는, 주문의 합계수를 표시하기 위해서 다음과 같은 것을 시험해 주세요.$order물건.

<?php echo $order->get_total(); ?>

언급URL : https://stackoverflow.com/questions/33755713/woocommerce-get-order-total

반응형