You are viewing an old revision of this post, from September 2, 2015 @ 13:53:33. See below for differences between this version and the current revision.

Storing WooCommerce Terms & Conditions in the Database

As written by Remi Corson: http://www.remicorson.com/storing-woocommerce-terms-conditions-in-the-database/ [php] /** * Store terms and conditions value within the database **/ add_action('woocommerce_checkout_update_order_meta', 'woo_save_terms_and_conditions_status'); function woo_save_terms_and_conditions_status( $order_id ) { if ($_POST['terms']) update_post_meta( $order_id, '_terms', esc_attr($_POST['terms'])); } add_action( 'woocommerce_admin_order_data_after_billing_address', 'woo_display_terms_and_conditions_status', 10, 1 ); function woo_display_terms_and_conditions_status($order){ $terms = get_post_meta( $order->id, '_terms', true ); $terms_status = ( $terms == 'on' ? __('accepted') : __('undefined') ); echo '<p><strong>'.__('Terms & conditions').':</strong> ' . $terms_status . '</p>'; }[/php]

Revisions

  • September 2, 2015 @ 13:53:33 [Current Revision] by PeterLugg
  • September 2, 2015 @ 13:53:33 by PeterLugg

Revision Differences

There are no differences between the September 2, 2015 @ 13:53:33 revision and the current revision. (Maybe only post meta information was changed.)

Tags:

No comments yet.

Leave a Reply