Repository › Forums › Support › WooCommerce Extended Coupon Features PRO › BOGO Fields not applying
- This topic has 3 replies, 2 voices, and was last updated 3 years, 1 month ago by Soft79.
-
AuthorPosts
-
October 9, 2020 at 1:43 pm #16497jenny@beautybyearth.comParticipant
We are trying to make the extend coupon features pro compatible with Woocommerce Smart Coupons so that we can export BOGO coupons.
We need this baby ‘_wjecf_bogo_matching_products’ to post to the csv headers and populate corresponding fields as a ‘Yes’
I’ve tried lots of versions and am not getting anywhere. . .
I’m assuming we’d need to modify these sections:
public function export_headers( $headers = array() ) {
$headers[‘wc_sc_user_role_ids’] = __( ‘User Role’, ‘woocommerce-smart-coupons’ );
return $headers;
}
/*
public function export_coupon_meta_data( $meta_value = ”, $args = array() ) {if ( ! empty( $args[‘meta_key’] ) && ‘wc_sc_user_role_ids’ === $args[‘meta_key’] ) {
if ( isset( $args[‘meta_value’] ) && ! empty( $args[‘meta_value’] ) ) {
$user_role_ids = maybe_unserialize( stripslashes( $args[‘meta_value’] ) );
if ( is_array( $user_role_ids ) && ! empty( $user_role_ids ) ) {
$user_role_names = $this->get_user_role_names_by_ids( $user_role_ids );
if ( is_array( $user_role_names ) && ! empty( $user_role_names ) ) {
$meta_value = implode( ‘|’, wc_clean( wp_unslash( $user_role_names ) ) ); // Replace user role ids with their respective role name.
}
}
}
}return $meta_value;
}
public function postmeta_defaults( $defaults = array() ) {
$defaults[‘wc_sc_user_role_ids’] = ”;
return $defaults;
}public function generate_coupon_meta( $data = array(), $post = array() ) {
$user_role_names = ”;
if ( ! empty( $post[‘wc_sc_user_role_ids’] ) && is_array( $post[‘wc_sc_user_role_ids’] ) ) {
$user_role_names = $this->get_user_role_names_by_ids( $post[‘wc_sc_user_role_ids’] );
if ( is_array( $user_role_names ) && ! empty( $user_role_names ) ) {
$user_role_names = implode( ‘|’, wc_clean( wp_unslash( $user_role_names ) ) );
}
}$data[‘wc_sc_user_role_ids’] = $user_role_names; // Replace user role ids with their respective role name.
return $data;
}It would be INCREDIBLY beneficial to us if you could please help us resolve this piece.
October 9, 2020 at 3:43 pm #16500Soft79KeymasterWe don’t have the Smart Coupons plugin ourselves, but I remember that that plugin had some filters to allow the support of extra fields. Please contact the author for more info.
Our plugin is compatible with the default import/export of WooCommerce though.
October 9, 2020 at 3:53 pm #16501jenny@beautybyearth.comParticipantHow is it compatible? The fields aren’t coming out when I export them
October 9, 2020 at 5:18 pm #16503Soft79KeymasterI mean the Tools > Export function, but this exports to xml, not csv.
-
AuthorPosts
- You must be logged in to reply to this topic.