Skip to content

Instantly share code, notes, and snippets.

@max-kk
Last active January 15, 2021 17:47
Show Gist options
  • Save max-kk/0f7a3ba10c751eae0f3eb73ced365b81 to your computer and use it in GitHub Desktop.
Save max-kk/0f7a3ba10c751eae0f3eb73ced365b81 to your computer and use it in GitHub Desktop.
WOR hooks
<?php
// COPY AFTER
add_action( "wccp/public/confirmation_page/after_left_column", function($order) {
echo $order->get_meta('jmeno_ditete_1');
echo $order->get_meta('billing_country');
}, 10, 1);
// Too add some data for specific section
// For billing:
add_filter( 'woocommerce_order_formatted_billing_address', function($billing_str, $order) {
return $billing_str . ' <br>Billing country: ' . $order->get_meta('billing_country');
});
// For shipping:
add_filter( 'woocommerce_order_formatted_shipping_address', function($shipping_str, $order) {
return $shipping_str . ' <br>Shipping company: {company}';
});
/*
'{first_name}' => $args['first_name'],
'{last_name}' => $args['last_name'],
'{name}' => $args['first_name'] . ' ' . $args['last_name'],
'{company}' => $args['company'],
'{address_1}' => $args['address_1'],
'{address_2}' => $args['address_2'],
'{city}' => $args['city'],
'{state}' => $full_state,
'{postcode}' => $args['postcode'],
'{country}' => $full_country,
'{first_name_upper}' => wc_strtoupper( $args['first_name'] ),
'{last_name_upper}' => wc_strtoupper( $args['last_name'] ),
'{name_upper}' => wc_strtoupper( $args['first_name'] . ' ' . $args['last_name'] ),
'{company_upper}' => wc_strtoupper( $args['company'] ),
'{address_1_upper}' => wc_strtoupper( $args['address_1'] ),
'{address_2_upper}' => wc_strtoupper( $args['address_2'] ),
'{city_upper}' => wc_strtoupper( $args['city'] ),
'{state_upper}' => wc_strtoupper( $full_state ),
'{state_code}' => wc_strtoupper( $state ),
'{postcode_upper}' => wc_strtoupper( $args['postcode'] ),
'{country_upper}' => wc_strtoupper( $full_country ),
*/
<!-- THIS IS A REAL PLUGIN CODE to display on how to displayed fields -->
<div id="Wccp_Confirmation_Page" class="woocommerce Wccp_Wrap">
<h2><?php echo WCCP_Localization::get_maybe_translated_setting('title'); ?></h2>
<div class="Wccp_Details">
<p class="Wccp_Text">
<?php echo WCCP_Localization::get_maybe_translated_setting('description'); ?>
</p>
<div class="col2-set Wccp_Page_Left">
<div class="col-1">
<?php self::render_column($order, $layout_settings, $layout_params, 'left'); ?>
<?php do_action('wccp/public/confirmation_page/after_left_column', $order); ?>
</div>
<div class="col-2 Wccp_Page_Right">
<?php self::render_column($order, $layout_settings, $layout_params, 'right'); ?>
<?php do_action('wccp/public/confirmation_page/after_right_column', $order); ?>
</div>
</div>
<div class="Wccp_Page_After">
<?php
// Integration with "WooCommerce Checkout Manager" - 4.1.6+
if ( function_exists('wooccm_add_payment_method_to_new_order') ) {
wooccm_add_payment_method_to_new_order($order, false);
//wooccm_add_payment_method_to_new_order();
}
self::render_column($order, $layout_settings, $layout_params, 'after');
do_action('wccp/public/confirmation_page/after_full_column', $order);
?>
</div>
</div>
<?php do_action('wccp/public/confirmation_page/before_confirm_button', $order); ?>
<p style="text-align: right;" class="Wccp_Page_Do_Payment">
<span class="Wccp_Page_Do_Payment__pre_complete_button_text">
<?php echo WCCP_Localization::get_maybe_translated_setting('pre_complete_button_text'); ?>
</span>
&nbsp;
<button id="wc-do-payment" data-id="<?php echo WCCP_Functions::get_order_data($order, 'id'); ?>" data-url="<?php echo $complete_order_url; ?>"
class="button alt"><?php echo apply_filters('wccp_complete_button_text', WCCP_Localization::get_maybe_translated_setting('complete_button_text')); ?></button>
</p>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment