本文整理汇总了PHP中woocommerce_checkout_payment函数的典型用法代码示例。如果您正苦于以下问题:PHP woocommerce_checkout_payment函数的具体用法?PHP woocommerce_checkout_payment怎么用?PHP woocommerce_checkout_payment使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了woocommerce_checkout_payment函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: do_action
<?php
do_action('woocommerce_checkout_order_review');
?>
</div>
<?php
do_action('woocommerce_checkout_after_order_review');
?>
</div>
<div class="col-2">
<?php
do_action('woocommerce_checkout_shipping');
?>
<?php
woocommerce_checkout_payment();
?>
</div>
</div>
<?php
do_action('woocommerce_checkout_after_customer_details');
?>
<?php
}
?>
</form>
<?php
开发者ID:elawn,项目名称:wicked,代码行数:31,代码来源:form-checkout.php
示例2: update_order_review
/**
* AJAX update order review on checkout
*/
public static function update_order_review()
{
ob_start();
check_ajax_referer('update-order-review', 'security');
if (!defined('WOOCOMMERCE_CHECKOUT')) {
define('WOOCOMMERCE_CHECKOUT', true);
}
if (WC()->cart->is_empty()) {
$data = array('fragments' => apply_filters('woocommerce_update_order_review_fragments', array('form.woocommerce-checkout' => '<div class="woocommerce-error">' . __('Sorry, your session has expired.', 'woocommerce') . ' <a href="' . home_url() . '" class="wc-backward">' . __('Return to homepage', 'woocommerce') . '</a></div>')));
wp_send_json($data);
die;
}
do_action('woocommerce_checkout_update_order_review', $_POST['post_data']);
$chosen_shipping_methods = WC()->session->get('chosen_shipping_methods');
if (isset($_POST['shipping_method']) && is_array($_POST['shipping_method'])) {
foreach ($_POST['shipping_method'] as $i => $value) {
$chosen_shipping_methods[$i] = wc_clean($value);
}
}
WC()->session->set('chosen_shipping_methods', $chosen_shipping_methods);
WC()->session->set('chosen_payment_method', empty($_POST['payment_method']) ? '' : $_POST['payment_method']);
if (isset($_POST['country'])) {
WC()->customer->set_country($_POST['country']);
}
if (isset($_POST['state'])) {
WC()->customer->set_state($_POST['state']);
}
if (isset($_POST['postcode'])) {
WC()->customer->set_postcode($_POST['postcode']);
}
if (isset($_POST['city'])) {
WC()->customer->set_city($_POST['city']);
}
if (isset($_POST['address'])) {
WC()->customer->set_address($_POST['address']);
}
if (isset($_POST['address_2'])) {
WC()->customer->set_address_2($_POST['address_2']);
}
if (wc_ship_to_billing_address_only()) {
if (isset($_POST['country'])) {
WC()->customer->set_shipping_country($_POST['country']);
}
if (isset($_POST['state'])) {
WC()->customer->set_shipping_state($_POST['state']);
}
if (isset($_POST['postcode'])) {
WC()->customer->set_shipping_postcode($_POST['postcode']);
}
if (isset($_POST['city'])) {
WC()->customer->set_shipping_city($_POST['city']);
}
if (isset($_POST['address'])) {
WC()->customer->set_shipping_address($_POST['address']);
}
if (isset($_POST['address_2'])) {
WC()->customer->set_shipping_address_2($_POST['address_2']);
}
} else {
if (isset($_POST['s_country'])) {
WC()->customer->set_shipping_country($_POST['s_country']);
}
if (isset($_POST['s_state'])) {
WC()->customer->set_shipping_state($_POST['s_state']);
}
if (isset($_POST['s_postcode'])) {
WC()->customer->set_shipping_postcode($_POST['s_postcode']);
}
if (isset($_POST['s_city'])) {
WC()->customer->set_shipping_city($_POST['s_city']);
}
if (isset($_POST['s_address'])) {
WC()->customer->set_shipping_address($_POST['s_address']);
}
if (isset($_POST['s_address_2'])) {
WC()->customer->set_shipping_address_2($_POST['s_address_2']);
}
}
WC()->cart->calculate_totals();
// Get order review fragment
ob_start();
woocommerce_order_review();
$woocommerce_order_review = ob_get_clean();
// Get checkout payment fragment
ob_start();
woocommerce_checkout_payment();
$woocommerce_checkout_payment = ob_get_clean();
// Get messages if reload checkout is not true
$messages = '';
if (!isset(WC()->session->reload_checkout)) {
ob_start();
wc_print_notices();
$messages = ob_get_clean();
}
$data = array('result' => empty($messages) ? 'success' : 'failure', 'messages' => $messages, 'reload' => isset(WC()->session->reload_checkout) ? 'true' : 'false', 'fragments' => apply_filters('woocommerce_update_order_review_fragments', array('.woocommerce-checkout-review-order-table' => $woocommerce_order_review, '.woocommerce-checkout-payment' => $woocommerce_checkout_payment)));
wp_send_json($data);
die;
//.........这里部分代码省略.........
开发者ID:JodiWarren,项目名称:woocommerce,代码行数:101,代码来源:class-wc-ajax.php
示例3: update_order_review
/**
* AJAX update order review on checkout.
*/
public static function update_order_review()
{
check_ajax_referer('update-order-review', 'security');
wc_maybe_define_constant('WOOCOMMERCE_CHECKOUT', true);
if (WC()->cart->is_empty()) {
self::update_order_review_expired();
}
do_action('woocommerce_checkout_update_order_review', $_POST['post_data']);
$chosen_shipping_methods = WC()->session->get('chosen_shipping_methods');
if (isset($_POST['shipping_method']) && is_array($_POST['shipping_method'])) {
foreach ($_POST['shipping_method'] as $i => $value) {
$chosen_shipping_methods[$i] = wc_clean($value);
}
}
WC()->session->set('chosen_shipping_methods', $chosen_shipping_methods);
WC()->session->set('chosen_payment_method', empty($_POST['payment_method']) ? '' : $_POST['payment_method']);
WC()->customer->set_props(array('billing_country' => isset($_POST['country']) ? $_POST['country'] : null, 'billing_state' => isset($_POST['state']) ? $_POST['state'] : null, 'billing_postcode' => isset($_POST['postcode']) ? $_POST['postcode'] : null, 'billing_city' => isset($_POST['city']) ? $_POST['city'] : null, 'billing_address_1' => isset($_POST['address']) ? $_POST['address'] : null, 'billing_address_2' => isset($_POST['address_2']) ? $_POST['address_2'] : null));
if (wc_ship_to_billing_address_only()) {
WC()->customer->set_props(array('shipping_country' => isset($_POST['country']) ? $_POST['country'] : null, 'shipping_state' => isset($_POST['state']) ? $_POST['state'] : null, 'shipping_postcode' => isset($_POST['postcode']) ? $_POST['postcode'] : null, 'shipping_city' => isset($_POST['city']) ? $_POST['city'] : null, 'shipping_address_1' => isset($_POST['address']) ? $_POST['address'] : null, 'shipping_address_2' => isset($_POST['address_2']) ? $_POST['address_2'] : null));
if (!empty($_POST['country'])) {
WC()->customer->set_calculated_shipping(true);
}
} else {
WC()->customer->set_props(array('shipping_country' => isset($_POST['s_country']) ? $_POST['s_country'] : null, 'shipping_state' => isset($_POST['s_state']) ? $_POST['s_state'] : null, 'shipping_postcode' => isset($_POST['s_postcode']) ? $_POST['s_postcode'] : null, 'shipping_city' => isset($_POST['s_city']) ? $_POST['s_city'] : null, 'shipping_address_1' => isset($_POST['s_address']) ? $_POST['s_address'] : null, 'shipping_address_2' => isset($_POST['s_address_2']) ? $_POST['s_address_2'] : null));
if (!empty($_POST['s_country'])) {
WC()->customer->set_calculated_shipping(true);
}
}
WC()->customer->save();
WC()->cart->calculate_totals();
// Get order review fragment
ob_start();
woocommerce_order_review();
$woocommerce_order_review = ob_get_clean();
// Get checkout payment fragment
ob_start();
woocommerce_checkout_payment();
$woocommerce_checkout_payment = ob_get_clean();
// Get messages if reload checkout is not true
$messages = '';
if (!isset(WC()->session->reload_checkout)) {
ob_start();
wc_print_notices();
$messages = ob_get_clean();
}
unset(WC()->session->refresh_totals, WC()->session->reload_checkout);
wp_send_json(array('result' => empty($messages) ? 'success' : 'failure', 'messages' => $messages, 'reload' => isset(WC()->session->reload_checkout) ? 'true' : 'false', 'fragments' => apply_filters('woocommerce_update_order_review_fragments', array('.woocommerce-checkout-review-order-table' => $woocommerce_order_review, '.woocommerce-checkout-payment' => $woocommerce_checkout_payment))));
}
开发者ID:woocommerce,项目名称:woocommerce,代码行数:51,代码来源:class-wc-ajax.php
注:本文中的woocommerce_checkout_payment函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论