Last active
October 29, 2024 17:46
-
-
Save MahdiAkrami01/810e328233276a117ccf7880b51dd2c1 to your computer and use it in GitHub Desktop.
Revisions
-
MahdiAkrami01 revised this gist
Oct 29, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ * * @see https://prnt.sc/zDSJuu5lyHqI * @author Mahdi Akrami * @url https://x.com/AkramiPro */ add_filter( 'get_post_metadata', static function ( $value, $object_id, $meta_key ) { if ( -
MahdiAkrami01 revised this gist
Oct 29, 2024 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,6 +5,7 @@ * * @see https://prnt.sc/zDSJuu5lyHqI * @author Mahdi Akrami * @url https://x.com/AkramiPro */ add_filter( 'get_post_metadata', static function ( $value, $object_id, $meta_key ) { if ( -
MahdiAkrami01 revised this gist
Oct 29, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ <?php /** * Force `Exclude sale items` And `Individual use only` options always enabled. * * @see https://prnt.sc/zDSJuu5lyHqI * @author Mahdi Akrami -
MahdiAkrami01 created this gist
Oct 29, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ <?php /** * Force `Exclude sale items` And `Individual use only` options enabled. * * @see https://prnt.sc/zDSJuu5lyHqI * @author Mahdi Akrami */ add_filter( 'get_post_metadata', static function ( $value, $object_id, $meta_key ) { if ( in_array( $meta_key, [ 'individual_use', 'exclude_sale_items' ] ) && get_post_type( $object_id ) === 'shop_coupon' ) { $value = [ 'yes' ]; } return $value; }, 9999, 3 );