This file contains 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 characters
// which file uploader... i.e. "File Uploader #1" in the settings: | |
$file_uploader_id = 1; | |
// with the WooCommerce $order_id, we can get all the files for $file_uploader_id here: | |
$order_files = get_post_meta( $order_id, '_alg_checkout_files_upload_' . $file_uploader_id, true ); | |
// $order_files will be an array. we can grab a specific file by key here: | |
$order_file = $order_files[ $file_key ]; | |
// once we've picked a single $order_file, we can access it's 'tmp_name' (name it's stored under on the server): |
This file contains 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 characters
add_filter( 'sliced_deposit_invoice_message', '__return_false' ); |
This file contains 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 characters
add_action( 'sliced_client_accepted_quote', 'si20220627_custom_quote_acceptance_action', 20, 2 ); | |
function si20220627_custom_quote_acceptance_action( $id, $new_post_id ) { | |
$invoice_id = $new_post_id ? $new_post_id : $id; | |
if ( $invoice_id ) { | |
if ( wp_redirect( get_permalink( $invoice_id ) ) ) { | |
exit; | |
} | |
} | |
} |
This file contains 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 characters
add_filter( 'sliced_invoices_non_cloneable_post_metas', 'si20220524_add_non_cloneable_post_metas' ); | |
function si20220524_add_non_cloneable_post_metas( $non_cloneable_post_metas ) { | |
$non_cloneable_post_metas[] = '_sliced_invoice_created'; | |
$non_cloneable_post_metas[] = '_sliced_invoice_due'; | |
return $non_cloneable_post_metas; | |
} |
This file contains 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 characters
function si20220524_preserve_quote_terms_on_invoice_before( $id ) { | |
global $si20220524_quote_terms; | |
$si20220524_quote_terms = get_post_meta( $id, '_sliced_quote_terms', true ); | |
} | |
function si20220524_preserve_quote_terms_on_invoice_after( $id, $new_post_id = null ) { | |
global $si20220524_quote_terms; | |
if ( $si20220524_quote_terms ) { | |
if ( $new_post_id ) { | |
// created new invoice from quote | |
update_post_meta( $new_post_id, '_sliced_invoice_terms', $si20220524_quote_terms ); |
This file contains 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 characters
add_filter( 'sliced_invoice_line_items_output', 'si20220317_sliced_invoice_line_items_output_custom' ); | |
function si20220317_sliced_invoice_line_items_output_custom( $output ) { | |
if ( preg_match_all('#<t[hd] class="qty">(.*?)</t[hd]>#', $output, $matches) ) { | |
$patterns = array(); | |
$replacements = array(); | |
foreach ( $matches[1] as $match ) { | |
$patterns[] = '#<t[hd] class="qty">'.$match.'</t[hd]>#'; | |
$replacements[] = ''; | |
} | |
$output = preg_replace($patterns, $replacements, $output); |
This file contains 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 characters
add_filter( 'sliced_get_invoice_terms', 'si20220310_do_shortcodes_in_terms' ); | |
function si20220310_do_shortcodes_in_terms( $content ) { | |
return do_shortcode( $content ); | |
} |
This file contains 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 characters
add_filter( 'comments_open', 'si20220222_disable_comments_for_all_quotes', 10, 2 ); | |
function si20220222_disable_comments_for_all_quotes( $open, $post_id = null ) { | |
$_post = get_post( $post_id ); | |
if ( $_post && ( $_post->post_type === 'sliced_quote' ) ) { | |
$open = false; | |
} | |
return $open; | |
} |
This file contains 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 characters
add_action( 'sliced_after_description', 'si20211021_pre_fill_quote_description' ); | |
function si20211021_pre_fill_quote_description( $cmb ) { | |
global $pagenow; | |
// only pre-fills new quotes | |
if ( $pagenow === 'post-new.php' && isset( $_GET['post_type'] ) && $_GET['post_type'] === 'sliced_quote' ) { | |
$field = $cmb->get_field( '_sliced_description' ); | |
if ( $field ) { | |
$field->args['default'] = 'Text to pre-fill goes here'; | |
} | |
} |
This file contains 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 characters
add_filter( 'sliced_get_gateway_authorize_net_label', 'sliced_customize_authorize_net_gateway_label' ); | |
function sliced_customize_authorize_net_gateway_label( $label ) { | |
return 'Pay by Credit Card'; | |
} |
NewerOlder