Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('make_offer_form_before_submit_button', 'add_custom_field_make_offer_form', 10);
- add_action('make_offer_after_save_form_data', 'save_custom_field_make_offer_form', 10, 2);
- add_action('make_offer_after_buyer_meta_display', 'display_custom_field_buyer_section');
- add_action('make_offer_email_display_custom_field_after_buyer_contact_details', 'display_custom_field_after_buyer_contact_details', 10, 1);
- function add_custom_field_make_offer_form() {
- ?>
- <div class="woocommerce-make-offer-form-section">
- <label for="offer_postcode"><?php echo __('Postcode / Zip', 'offers-for-woocommerce'); ?></label>
- <br><input type="text" value="" required="required" name="offer_postcode">
- </div>
- <?php
- }
- function save_custom_field_make_offer_form($post_id, $post) {
- if (isset($post['offer_postcode']) && !empty($post['offer_postcode'])) {
- add_post_meta($post_id, 'offer_postcode', $post['offer_postcode']);
- }
- }
- function display_custom_field_buyer_section($post_id) {
- $offer_postcode = get_post_meta($post_id, 'offer_postcode', true);
- ?>
- <li><span><?php echo __('Postcode / Zip:', 'offers-for-woocommerce'); ?> </span><?php echo (isset($offer_postcode)) ? stripslashes($offer_postcode) : __('Missing Meta Value', 'offers-for-woocommerce'); ?></li>
- <?php
- }
- function display_custom_field_after_buyer_contact_details($post_id) {
- $offer_postcode = get_post_meta($post_id, 'offer_postcode', true);
- echo (isset($offer_postcode) && !empty($offer_postcode)) ? '<br /><strong>' . __('Postcode / Zip:', 'offers-for-woocommerce') . ' </strong>' . stripslashes($offer_postcode) : '';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement