daymobrew
Forum Replies Created
-
Yes, still an issue.
CMB2_Hookup::save_post()
andCMB2_Hookup::can_save()
are being run on save but not the ‘cmb2_override_meta_save
‘ filter ascan_save()
returnsfalse
.I have the following filters running successfully:
// To read from custom table.
add_filter( 'cmb2_override_meta_value', 'dcwd_cmb2_override_meta_value', 10, 4 );
// To get past can_save() checks. Returns true when my 2 fields are in $_POST.
add_filter( 'cmb2_can_save', 'dcwd_cmb2_can_save', 10, 2 );
but my ‘
cmb2_override_meta_save
‘ filter is not running. I also have ‘cmb2_override_tracking_number_meta_save
‘ and ‘cmb2_override_tracking_url_meta_save
‘ (to match field IDs) but they don’t run either.Partial code: https://pastebin.com/sEQr7Rcu
- This reply was modified 1 year, 7 months ago by daymobrew. Reason: Make code comments easier to read
Forum: Plugins
In reply to: [CMB2] How do I show metabox on WooCommerce Order page for HPOS setupThe PR has been merged into the CMB2 develop branch so closing this thread.
Forum: Plugins
In reply to: [CMB2] How do I show metabox on WooCommerce Order page for HPOS setupIs this better? (I have a feeling it isn’t).
https://github.com/CMB2/CMB2/pull/1495
If not then I’ll submit as a GitHub Issue.
Forum: Plugins
In reply to: [CMB2] How do I show metabox on WooCommerce Order page for HPOS setupOk, I’ll try that tomorrow. I used GitHub web interface and it made me fork it.
I’ve been going through the includes/CMB2_Hookup.php code. I can see that
save_post()
is not being called. Looking through the WooCommerce code maybe ‘woocommerce_process_shop_order_meta’ needs to be hooked to.add_action( 'woocommerce_process_shop_order_meta', array( $this, 'save_post' ), 10, 2 );
Adding this helps a lot!
can_save()
gets run though$type
is not set so it fails. It’s not set becausesave_post()
cannot determine the post type.I could use the ‘
cmb2_can_save
‘ filter to override can_save()’s false result but that seems risky.Forum: Plugins
In reply to: [CMB2] How do I show metabox on WooCommerce Order page for HPOS setupThe CMB2 styles are not being loaded so the text field max-width is not set to 100% (it says as
.regular-text { width: 25em; }
)I created a pull request to load CMB2 styles on the WooCommerce Edit Order page when HPOS enabled: https://github.com/damiencarbery/CMB2/pull/1
Forum: Plugins
In reply to: [CMB2] How do I show metabox on WooCommerce Order page for HPOS setupI experimented a bit and found that
get_current_screen()->id == 'woocommerce_page_wc-orders'
so the metabox now shows.I’ll experiment a bit more before marking this as resolved.
Brilliant, thank you. I should have looked around the page better.
Forum: Plugins
In reply to: [Facebook for WooCommerce] UPDATE BREAKS ADMIN PRODUCT SEARCHSame issue for me.
Urls are getting multiple #038; added to them. Some still work, other actions redirect to posts page as other are experiencing.
Forum: Plugins
In reply to: [Deposits & Partial Payments for WooCommerce] Multiple deposit amounts?Thanks. I tested the Pro demo and it looks good.
I saw that the Payment Plans have % amounts. Is it possible for me to have one option where the first payment is 250 euro? Or is there a filter in the code where I could set the first payment amount to 250 euro?
I primarily post code for me as I may reuse it. When it helps others it’s a brilliant bonus.
If you find any issues or have enhancement suggestions/requests, post a comment on the post (or here).
A few years ago I developed some JavaScript that would achieve this. It watches for changes to the variations dropdowns and copies the selected data to a hidden hidden CF7DTE field.
See: https://www.damiencarbery.com/2019/12/contact-form-7-product-enquiry-form-for-variable-products/
You should look at the elementor/frontend/{$element_type}/should_render filter.
I used the CSS Classes and CSS ID fields in my version of function A().
You might get ideas at my post:
https://www.damiencarbery.com/2022/05/conditionally-show-an-elementor-section/Forum: Plugins
In reply to: [WP Store Locator] How to change layout of single store pageEven though it gives a lot of control, I was trying to avoid that option because I would have had to duplicate a lot of code (using GeneratePress).
My solution works though it could be a maintenance problem if [wpsl_address] changes in the future.
Forum: Plugins
In reply to: [WP Store Locator] How to change layout of single store pageI think I found a solution – remove the cpt_template() filter and add a custom shortcode to ‘the_content’. Thanks for adding WP_Store_locator class to $GLOBALS.
add_filter( 'the_content', 'bh_custom_single_store_content', 5 ); function bh_custom_single_store_content( $content ) { if ( is_singular( 'wpsl_stores' ) ) { remove_filter( 'the_content', array( $GLOBALS['wpsl']->frontend, 'cpt_template' ) ); // Add WP Store Locator map and custom shortcode for address. return '[wpsl_map][hb_wpsl_address]' . $content; } return $content; }
I copied WPSL_Frontend::show_store_address() function to a new name and edited it to add the new fields I added.
Is this a good solution?