Return the email classes - used in admin to load settings.
public get_emails ( ) : array | ||
리턴 | array |
public function __construct($order_id = 0) { $this->order_id = $order_id; $this->order = new WC_Order($this->order_id); $wc_emails = new WC_Emails(); $this->emails = $wc_emails->get_emails(); }
function run_email_script() { // assign email address and order id variables if (get_option("wc_email_test_email", false)) { $wc_email_test_email = get_option("wc_email_test_email", false); } else { $wc_email_test_email = get_bloginfo('admin_email'); } if (get_option("wc_email_test_order_id", false) == 'recent') { $wc_email_test_order_id = ''; } else { $wc_email_test_order_id = get_option("wc_email_test_order_id", false); } if (!$wc_email_test_order_id) { // get a valid and most recent order_id ( if no order is has been selected ) global $wpdb; $order_id_query = 'SELECT order_id FROM ' . $wpdb->prefix . 'woocommerce_order_items ORDER BY order_item_id DESC LIMIT 1'; $order_id = $wpdb->get_results($order_id_query); if (empty($order_id)) { echo "No order within your WooCommerce shop. Please create a test order first to test the emails"; return; } else { $wc_email_test_order_id = $order_id[0]->order_id; } } // the email type to send $email_class = get_query_var('woocommerce_email_test'); $for_filter = strtolower(str_replace('WC_Email_', '', $email_class)); // change email address within order to saved option add_filter('woocommerce_email_recipient_' . $for_filter, 'your_email_recipient_filter_function', 10, 2); function your_email_recipient_filter_function($recipient, $object) { global $wc_email_test_email; $recipient = $wc_email_test_email; return $recipient; } // change subject link add_filter('woocommerce_email_subject_' . $for_filter, 'change_admin_email_subject', 1, 2); function change_admin_email_subject($subject, $order) { global $woocommerce; $subject = "TEST EMAIL: " . $subject; return $subject; } if (isset($GLOBALS['wc_advanced_notifications'])) { unset($GLOBALS['wc_advanced_notifications']); } // load the email classs $wc_emails = new WC_Emails(); $emails = $wc_emails->get_emails(); // select the email we want & send $new_email = $emails[$email_class]; // make sure email isn't sent apply_filters('woocommerce_email_enabled_' . $for_filter, false, $new_email->object); $new_email->trigger($wc_email_test_order_id); // echo the email content for browser echo $new_email->style_inline($new_email->get_content()); }
public function addOfferNoteCallback() { if (is_admin() && (defined('DOING_AJAX') || DOING_AJAX)) { $post_id = $_POST["targetID"]; // Get current data for Offer $post_data = get_post($post_id); // Filter Post Status Label $post_status_text = strtolower($post_data->post_status) == 'publish' ? 'Pending' : $post_data->post_status; $post_status_text = ucwords(str_replace("-", " ", str_replace("offer", " ", strtolower($post_status_text)))); $noteSendToBuyer = isset($_POST["noteSendToBuyer"]) && $_POST["noteSendToBuyer"] != '' ? '1' : ''; $offer_notes = $_POST['noteContent']; $current_user = wp_get_current_user(); // Insert WP comment $comment_text = "<span>" . __('Offer Note:', $this->plugin_slug) . "</span>"; if ($noteSendToBuyer != '1') { $comment_text .= " " . __('(admin only)', $this->plugin_slug); } else { $comment_text .= " " . __('(sent to buyer)', $this->plugin_slug); } $comment_text .= "<br />" . $offer_notes; $data = array('comment_post_ID' => '', 'comment_author' => $current_user->user_login, 'comment_author_email' => $current_user->user_email, 'comment_author_url' => '', 'comment_content' => $comment_text, 'comment_type' => '', 'comment_parent' => 0, 'user_id' => get_current_user_id(), 'comment_author_IP' => $_SERVER['REMOTE_ADDR'], 'comment_agent' => '', 'comment_date' => date("Y-m-d H:i:s", current_time('timestamp', 0)), 'comment_approved' => 'post-trashed'); $new_comment_id = wp_insert_comment($data); // insert comment meta if ($new_comment_id) { add_comment_meta($new_comment_id, 'angelleye_woocommerce_offer_id', $post_id, true); } if ($new_comment_id) { if ($noteSendToBuyer == '1') { // Email buyer the offer note (not private admin note) /** * Offer note email template * @since 0.1.0 */ // set recipient email $recipient = get_post_meta($post_id, 'offer_email', true); $offer_id = $post_id; $offer_uid = get_post_meta($post_id, 'offer_uid', true); $offer_name = get_post_meta($post_id, 'offer_name', true); $offer_email = $recipient; $product_id = get_post_meta($post_id, 'offer_product_id', true); $variant_id = get_post_meta($post_id, 'offer_variation_id', true); $_pf = new WC_Product_Factory(); $product = $variant_id ? $_pf->get_product($variant_id) : $_pf->get_product($product_id); // if buyercountered-offer previous then use buyer counter values $is_offer_buyer_countered_status = $post_data->post_status == 'buyercountered-offer' ? true : false; $product_qty = $is_offer_buyer_countered_status ? get_post_meta($post_id, 'offer_buyer_counter_quantity', true) : get_post_meta($post_id, 'offer_quantity', true); $product_price_per = $is_offer_buyer_countered_status ? get_post_meta($post_id, 'offer_buyer_counter_price_per', true) : get_post_meta($post_id, 'offer_price_per', true); $product_total = $product_qty * $product_price_per; $offer_args = array('recipient' => $recipient, 'offer_email' => $offer_email, 'offer_name' => $offer_name, 'offer_id' => $offer_id, 'offer_uid' => $offer_uid, 'product_id' => $product_id, 'product_url' => $product->get_permalink(), 'variant_id' => $variant_id, 'product' => $product, 'product_qty' => $product_qty, 'product_price_per' => $product_price_per, 'product_total' => $product_total, 'offer_notes' => $offer_notes); if ($variant_id) { if ($product->get_sku()) { $identifier = $product->get_sku(); } else { $identifier = '#' . $product->variation_id; } $attributes = $product->get_variation_attributes(); $extra_data = ' – ' . implode(', ', $attributes); $offer_args['product_title_formatted'] = sprintf(__('%s – %s%s', 'woocommerce'), $identifier, $product->get_title(), $extra_data); } else { $offer_args['product_title_formatted'] = $product->get_formatted_name(); } // the email we want to send $email_class = 'WC_Offer_Note_Email'; // load the WooCommerce Emails $wc_emails = new WC_Emails(); $emails = $wc_emails->get_emails(); // select the email we want & trigger it to send $new_email = $emails[$email_class]; $new_email->recipient = $recipient; // set plugin slug in email class $new_email->plugin_slug = $this->plugin_slug; // define email template/path (html) $new_email->template_html = 'woocommerce-offer-note.php'; $new_email->template_html_path = plugin_dir_path(__FILE__) . 'includes/emails/'; // define email template/path (plain) $new_email->template_plain = 'woocommerce-offer-note.php'; $new_email->template_plain_path = plugin_dir_path(__FILE__) . 'includes/emails/plain/'; $new_email->trigger($offer_args); } $redirect_url = admin_url('post.php?post=' . $post_id . '&action=edit&noheader=true&message=11'); echo $redirect_url; } else { echo 'failed'; } die; // this is required to return a proper result } }
public function new_offer_form_submit() { if (!is_admin()) { global $wpdb; // this is how you get access to the database // Check if form was posted and select task accordingly if (isset($_REQUEST['woocommerceoffer_post']) && isset($_POST["offer_product_id"]) && $_POST["offer_product_id"] != '') { // set postmeta original vars $formData['orig_offer_name'] = isset($_POST['offer_name']) ? $_POST['offer_name'] : ''; $formData['orig_offer_company_name'] = isset($_POST['offer_company_name']) ? $_POST['offer_company_name'] : ''; $formData['orig_offer_phone'] = isset($_POST['offer_phone']) ? $_POST['offer_phone'] : ''; $formData['orig_offer_email'] = isset($_POST['offer_email']) ? $_POST['offer_email'] : ''; $formData['orig_offer_product_id'] = isset($_POST['offer_product_id']) ? $_POST['offer_product_id'] : ''; $formData['orig_offer_variation_id'] = isset($_POST['offer_variation_id']) ? $_POST['offer_variation_id'] : ''; $formData['orig_offer_quantity'] = isset($_POST['offer_quantity']) ? $_POST['offer_quantity'] : '0'; $formData['orig_offer_price_per'] = isset($_POST['offer_price_each']) ? $_POST['offer_price_each'] : '0'; $formData['orig_offer_amount'] = number_format(round($formData['orig_offer_quantity'] * $formData['orig_offer_price_per']), 2, ".", ""); $formData['orig_offer_uid'] = uniqid('aewco-'); $formData['parent_offer_uid'] = isset($_POST['parent_offer_uid']) ? $_POST['parent_offer_uid'] : ''; /** * Check minimum quantity and minimum price */ // check for valid offer quantity (not zero) if ($formData['orig_offer_quantity'] == '' || $formData['orig_offer_quantity'] == 0) { echo json_encode(array("statusmsg" => 'failed-custom', "statusmsgDetail" => __('Please enter a positive value for \'Offer Quantity\'', $this->plugin_slug))); exit; } // check for valid offer price (not zero) if ($formData['orig_offer_price_per'] == '' || $formData['orig_offer_price_per'] == 0 || $formData['orig_offer_price_per'] == "0.00") { echo json_encode(array("statusmsg" => 'failed-custom', "statusmsgDetail" => __('Please enter a positive value for \'Offer Amount\'', $this->plugin_slug))); exit; } // set postmeta vars $formData['offer_name'] = $formData['orig_offer_name']; $formData['offer_company_name'] = $formData['orig_offer_company_name']; $formData['offer_phone'] = $formData['orig_offer_phone']; $formData['offer_email'] = $formData['orig_offer_email']; $formData['offer_product_id'] = $formData['orig_offer_product_id']; $formData['offer_variation_id'] = $formData['orig_offer_variation_id']; $formData['offer_quantity'] = $formData['orig_offer_quantity']; $formData['offer_price_per'] = $formData['orig_offer_price_per']; $formData['offer_amount'] = $formData['orig_offer_amount']; $formData['offer_uid'] = $formData['orig_offer_uid']; // if not logged in, check for matching wp user by email // set author_data $author_data = !is_user_logged_in() ? get_user_by('email', $formData['offer_email']) : false; if ($author_data) { $newPostData['post_author'] = $author_data->ID; } // set post vars $newPostData['post_date'] = date("Y-m-d H:i:s", current_time('timestamp', 0)); $newPostData['post_date_gmt'] = gmdate("Y-m-d H:i:s", time()); $newPostData['post_type'] = 'woocommerce_offer'; $newPostData['post_status'] = 'publish'; $newPostData['post_title'] = $formData['offer_email']; // set offer comments $comments = isset($_POST['offer_notes']) && $_POST['offer_notes'] != '' ? strip_tags(nl2br($_POST['offer_notes']), '<br><p>') : ''; /** * Akismet spam check * Passes back true (it's spam) or false (it's ham) * @since 1.2.0 */ $akismet_api_key = '9a57112207be'; $data = array('blog' => get_site_url(), 'user_ip' => $_SERVER['REMOTE_ADDR'], 'user_agent' => $_SERVER['HTTP_USER_AGENT'], 'referrer' => '', 'permalink' => get_permalink($formData['offer_product_id']), 'comment_type' => 'woocommerce_offer', 'comment_author' => $formData['offer_name'], 'comment_author_email' => $formData['offer_email'], 'comment_author_url' => '', 'comment_content' => $comments); if ($this->aeofwc_akismet_comment_check($akismet_api_key, $data)) { // is spam echo json_encode(array("statusmsg" => 'failed-spam', "statusmsgDetail" => __('Invalid Offer Submission; See shop manager for assistance', $this->plugin_slug))); exit; } // check for parent post id $parent_post_id = isset($_POST['parent_offer_id']) ? $_POST['parent_offer_id'] : ''; $parent_post_status = get_post_status($parent_post_id); $post_parent_type = get_post_type($parent_post_id); // If has valid parent offer id post $is_counter_offer = $parent_post_id != '' ? true : false; if ($is_counter_offer) { // check for parent offer unique id $parent_post_offer_uid = get_post_meta($parent_post_id, 'offer_uid', true); // check for valid parent offer ( must be a offer post type and accepted/countered and uid must match if (isset($parent_post_status) && $parent_post_status != 'countered-offer' || $post_parent_type != 'woocommerce_offer' || $parent_post_offer_uid != $formData['parent_offer_uid']) { echo json_encode(array("statusmsg" => 'failed-custom', "statusmsgDetail" => __('Invalid Parent Offer Id; See shop manager for assistance', $this->plugin_slug))); exit; } $parent_post = array('ID' => $parent_post_id, 'post_modified' => date("Y-m-d H:i:s", current_time('timestamp', 0)), 'post_modified_gmt' => gmdate("Y-m-d H:i:s", current_time('timestamp', 0)), 'post_status' => 'buyercountered-offer'); if ($author_data) { $parent_post['post_author'] = $newPostData['post_author']; } // Update the parent post into the database wp_update_post($parent_post); $formDataUpdated = array(); $formDataUpdated['offer_buyer_counter_quantity'] = $formData['offer_quantity']; $formDataUpdated['offer_buyer_counter_price_per'] = $formData['offer_price_per']; $formDataUpdated['offer_buyer_counter_amount'] = $formData['offer_amount']; // Insert new Post Meta Values foreach ($formDataUpdated as $k => $v) { $newPostMetaData = array(); $newPostMetaData['post_id'] = $parent_post_id; $newPostMetaData['meta_key'] = $k; $newPostMetaData['meta_value'] = $v; update_post_meta($parent_post_id, $newPostMetaData['meta_key'], $newPostMetaData['meta_value']); } // Insert WP comment $comment_text = "<span>" . __('Buyer Submitted Counter Offer', $this->plugin_slug) . "</span>"; if ($comments != '') { // Insert WP comment $comment_text .= '<br />' . $comments; } $data = array('comment_post_ID' => '', 'comment_author' => 'admin', 'comment_author_email' => '', 'comment_author_url' => '', 'comment_content' => $comment_text, 'comment_type' => '', 'comment_parent' => 0, 'user_id' => '', 'comment_author_IP' => $_SERVER['REMOTE_ADDR'], 'comment_agent' => '', 'comment_date' => date("Y-m-d H:i:s", current_time('timestamp', 0)), 'comment_approved' => 'post-trashed'); $new_comment_id = wp_insert_comment($data); // insert comment meta if ($new_comment_id) { add_comment_meta($new_comment_id, 'angelleye_woocommerce_offer_id', $parent_post_id, true); } } else { // Insert new Post $parent_post_id = wp_insert_post($newPostData); if ($parent_post_id) { // Insert new Post Meta Values foreach ($formData as $k => $v) { $newPostMetaData = array(); $newPostMetaData['post_id'] = $parent_post_id; $newPostMetaData['meta_key'] = $k; $newPostMetaData['meta_value'] = $v; add_post_meta($newPostMetaData['post_id'], $newPostMetaData['meta_key'], $newPostMetaData['meta_value']); } // Insert WP comment $comment_text = "<span>" . __('Created New Offer', $this->plugin_slug) . "</span>"; if ($comments != '') { // Insert WP comment $comment_text .= '<br />' . $comments; } $data = array('comment_post_ID' => '', 'comment_author' => 'admin', 'comment_author_email' => '', 'comment_author_url' => '', 'comment_content' => $comment_text, 'comment_type' => '', 'comment_parent' => 0, 'user_id' => 1, 'comment_author_IP' => '127.0.0.1', 'comment_agent' => '', 'comment_date' => date("Y-m-d H:i:s", current_time('timestamp', 0)), 'comment_approved' => 'post-trashed'); $new_comment_id = wp_insert_comment($data); // insert comment meta if ($new_comment_id) { add_comment_meta($new_comment_id, 'angelleye_woocommerce_offer_id', $parent_post_id, true); } } else { // return error msg echo json_encode(array("statusmsg" => 'failed', "statusmsgDetail" => 'database error')); exit; } } /** * Email Out - admin email notification of new or countered offer * @since 0.1.0 */ $offer_id = $parent_post_id; $offer_name = get_post_meta($parent_post_id, 'offer_name', true); $offer_phone = get_post_meta($parent_post_id, 'offer_phone', true); $offer_company_name = get_post_meta($parent_post_id, 'offer_company_name', true); $offer_email = get_post_meta($parent_post_id, 'offer_email', true); $product_id = get_post_meta($parent_post_id, 'offer_product_id', true); $variant_id = get_post_meta($parent_post_id, 'offer_variation_id', true); $_pf = new WC_Product_Factory(); $product = $variant_id ? $_pf->get_product($variant_id) : $_pf->get_product($product_id); $product_qty = $formData['offer_quantity']; $product_price_per = $formData['offer_price_per']; $product_total = $formData['offer_amount']; $offer_args = array('offer_email' => $offer_email, 'offer_name' => $offer_name, 'offer_phone' => $offer_phone, 'offer_company_name' => $offer_company_name, 'offer_id' => $offer_id, 'product_id' => $product_id, 'product_url' => get_permalink($product_id), 'variant_id' => $variant_id, 'product' => $product, 'product_qty' => $product_qty, 'product_price_per' => $product_price_per, 'product_total' => $product_total, 'offer_notes' => $comments); if ($variant_id) { if ($product->get_sku()) { $identifier = $product->get_sku(); } else { $identifier = '#' . $product->variation_id; } $attributes = $product->get_variation_attributes(); $extra_data = ' – ' . implode(', ', $attributes); $offer_args['product_title_formatted'] = sprintf(__('%s – %s%s', 'woocommerce'), $identifier, $product->get_title(), $extra_data); } else { if (!empty($product)) { $identifier = $product->get_sku(); } else { $identifier = '#' . $product_id; } $offer_args['product_title_formatted'] = sprintf(__('%s – %s', 'woocommerce'), $identifier, $product->get_title()); } if ($is_counter_offer) { $offer_args['is_counter_offer'] = true; /** * send admin 'New counter offer' email template */ // the email we want to send $email_class = 'WC_New_Counter_Offer_Email'; } else { $offer_args['is_counter_offer'] = false; /** * send admin 'New offer' email template */ // the email we want to send $email_class = 'WC_New_Offer_Email'; } // load the WooCommerce Emails $wc_emails = new WC_Emails(); $emails = $wc_emails->get_emails(); // select the email we want & trigger it to send $new_email = $emails[$email_class]; // set plugin slug in email class $new_email->plugin_slug = $this->plugin_slug; if ($is_counter_offer) { // define email template/path (html) $new_email->template_html = 'woocommerce-new-counter-offer.php'; $new_email->template_html_path = plugin_dir_path(__FILE__) . 'includes/emails/'; // define email template/path (plain) $new_email->template_plain = 'woocommerce-new-counter-offer.php'; $new_email->template_plain_path = plugin_dir_path(__FILE__) . 'includes/emails/plain/'; } else { // define email template/path (html) $new_email->template_html = 'woocommerce-new-offer.php'; $new_email->template_html_path = plugin_dir_path(__FILE__) . 'includes/emails/'; // define email template/path (plain) $new_email->template_plain = 'woocommerce-new-offer.php'; $new_email->template_plain_path = plugin_dir_path(__FILE__) . 'includes/emails/plain/'; } $new_email->trigger($offer_args); /** * Send buyer 'offer received' email notification */ // the email we want to send $email_class = 'WC_Offer_Received_Email'; // set recipient $recipient = $offer_email; $offer_args['recipient'] = $offer_email; // select the email we want & trigger it to send $new_email = $emails[$email_class]; $new_email->recipient = $recipient; // set plugin slug in email class $new_email->plugin_slug = $this->plugin_slug; // define email template/path (html) $new_email->template_html = 'woocommerce-offer-received.php'; $new_email->template_html_path = plugin_dir_path(__FILE__) . 'includes/emails/'; // define email template/path (plain) $new_email->template_plain = 'woocommerce-offer-received.php'; $new_email->template_plain_path = plugin_dir_path(__FILE__) . 'includes/emails/plain/'; $new_email->trigger($offer_args); // Success echo json_encode(array("statusmsg" => 'success')); exit; } } }
/** * * @global type $wpdb * @param type $offer_id * @param type $emails * @since 1.2.0 */ public function ofw_auto_decline_offer($offer_id = null, $emails = null) { global $wpdb; if (isset($_POST["targetID"]) && !empty($_POST["targetID"])) { $post_id = $_POST["targetID"]; } else { $post_id = $offer_id; } if (isset($post_id) && !empty($post_id)) { $post_data = get_post($post_id); $is_offer_buyer_countered_status = $post_data->post_status == 'buyercountered-offer' ? true : false; $table = $wpdb->prefix . "posts"; $data_array = array('post_status' => 'declined-offer', 'post_modified' => date("Y-m-d H:i:s", current_time('timestamp', 0)), 'post_modified_gmt' => date("Y-m-d H:i:s", current_time('timestamp', 1))); $where = array('ID' => $post_id); $wpdb->update($table, $data_array, $where); $post_status_text = __('Declined', $this->plugin_slug); $offer_notes = isset($_POST['angelleye_woocommerce_offer_status_notes']) && $_POST['angelleye_woocommerce_offer_status_notes'] != '' ? $_POST['angelleye_woocommerce_offer_status_notes'] : ''; $recipient = get_post_meta($post_id, 'offer_email', true); $offer_id = $post_id; $offer_uid = get_post_meta($post_id, 'offer_uid', true); $offer_name = get_post_meta($post_id, 'offer_name', true); $offer_email = $recipient; $product_id = get_post_meta($post_id, 'offer_product_id', true); $variant_id = get_post_meta($post_id, 'offer_variation_id', true); $_pf = new WC_Product_Factory(); $product = $variant_id ? $_pf->get_product($variant_id) : $_pf->get_product($product_id); $product_qty = $is_offer_buyer_countered_status ? get_post_meta($post_id, 'offer_buyer_counter_quantity', true) : get_post_meta($post_id, 'offer_quantity', true); $product_price_per = $is_offer_buyer_countered_status ? get_post_meta($post_id, 'offer_buyer_counter_price_per', true) : get_post_meta($post_id, 'offer_price_per', true); $product_total = $product_qty * $product_price_per; if ($is_offer_buyer_countered_status) { update_post_meta($post_id, 'offer_quantity', $product_qty); update_post_meta($post_id, 'offer_price_per', $product_price_per); update_post_meta($post_id, 'offer_amount', $product_total); } $offer_args = array('recipient' => $recipient, 'offer_email' => $offer_email, 'offer_name' => $offer_name, 'offer_id' => $offer_id, 'offer_uid' => $offer_uid, 'product_id' => $product_id, 'product_url' => $product->get_permalink(), 'variant_id' => $variant_id, 'product' => $product, 'product_qty' => $product_qty, 'product_price_per' => $product_price_per, 'product_total' => $product_total, 'offer_notes' => $offer_notes); if ($variant_id) { if ($product->get_sku()) { $identifier = $product->get_sku(); } else { $identifier = '#' . $product->variation_id; } $attributes = $product->get_variation_attributes(); $extra_data = ' – ' . implode(', ', $attributes); $offer_args['product_title_formatted'] = sprintf(__('%s – %s%s', 'woocommerce'), $identifier, $product->get_title(), $extra_data); } else { $offer_args['product_title_formatted'] = $product->get_formatted_name(); } $email_class = 'WC_Declined_Offer_Email'; if (empty($emails)) { $wc_emails = new WC_Emails(); $emails = $wc_emails->get_emails(); } $new_email = $emails[$email_class]; $new_email->recipient = $recipient; $new_email->plugin_slug = $this->plugin_slug; $new_email->template_html = 'woocommerce-offer-declined.php'; $new_email->template_html_path = untrailingslashit(OFW_PLUGIN_URL) . '/admin/includes/emails/'; $new_email->template_plain = 'woocommerce-offer-declined.php'; $new_email->template_plain_path = untrailingslashit(OFW_PLUGIN_URL) . '/admin/includes/emails/plain/'; $new_email->trigger($offer_args); $comment_text = "<span>Updated - Status: </span>"; $comment_text .= $post_status_text; if (isset($offer_notes) && $offer_notes != '') { $comment_text .= '</br>' . nl2br($offer_notes); } $data = array('comment_post_ID' => '', 'comment_author' => 'admin', 'comment_author_email' => '', 'comment_author_url' => '', 'comment_content' => $comment_text, 'comment_type' => '', 'comment_parent' => 0, 'user_id' => get_current_user_id(), 'comment_author_IP' => $_SERVER['REMOTE_ADDR'], 'comment_agent' => '', 'comment_date' => date("Y-m-d H:i:s", current_time('timestamp', 0)), 'comment_approved' => 'post-trashed'); $new_comment_id = wp_insert_comment($data); if ($new_comment_id) { add_comment_meta($new_comment_id, 'angelleye_woocommerce_offer_id', $post_id, true); } } }