Simon Kane
Forum Replies Created
-
Forum: Plugins
In reply to: [Payment Plugins for Stripe WooCommerce] New filter requestThank you!
Might there be any timeframe for this?
Also, I am finding that there are plugins out there that define custom objects based on WC_Order (‘shop_order’) just as:
woocommerce/includes/class-wc-order.php:16
`class WC_Order extends WC_Abstract_Order {‘
If the custom order type extends WC_Order, without touching the things you touch,
it wouldn’t be a problem for the payment gateway – and for the same reasons.You (very correctly):
‘class WC_Payment_Gateway_Stripe_CC extends WC_Payment_Gateway_Stripe {‘
which is in turn:
‘abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {‘I was wondering how I was going to handle a client requested enhancement
until I ran into the fact that the above is possible. I haven’t written it yet,
and my extended WC_Order likely won’t need this, but the overall community might.As for being “error prone” and having compatibility issues,
isn’t that true for any filter?
If the user’s filter code is written incorrectly, it could break anything –
and it’s not your responsibility.
This has been a truism since IBM invented “user exits” in the mid-1970s.Yes – your fix worked – it no longer explodes.
However, there seems to be some issues with billing addresses.
It is showing placeholders for shipping-only fields, and there’s no way to set a nickname for the billing address as far as I’ve found. I’ll be looking into this more shortly.Forum: Plugins
In reply to: [Media Sync] Attachment metadata could not be generated fromI actually use the filter in Media Sync to attach files to products and pages. This is done by having the filename being imported follow a set of site/client-specific rules that tell the code what the file is for.
I think you need a developer to create the necessary custom code specific to your need.
Forum: Plugins
In reply to: [Media Sync] Plugin ignores -scaled filesI disagree. This plugin is designedto import items that do not already exist in WordPress. A “-scaled” file, just like a 100×100, has been processed. Because the WP site that the item is being imported to may not have the same settings as the WP site where the deserived files were created, using anything other than the original file could cause both confusion, and incorrect results.
And we haven’t even touched on “-rotated” yet. π
Nor whatever other WP special things might crop up in the future.If you really need special handling and ignores, the filters are definitely what you need to use. I created one that does special handling for attaching series of images to WooCommerce products and tagging that in the Media Library so it’s even cross-referenced — it is not difficult to create any kind of unique handler you might need.
- This reply was modified 5 years, 1 month ago by Simon Kane. Reason: typos
Forum: Plugins
In reply to: [Media Sync] Updating Existing FilesBase WordPress does not support “replacement” of media objects.
There are plugins out there that may help you, but you need to be sure it will preserve your media meta data (such as description).
That being said, maybe you can get away with just dropping a replacement PDF over the existing one without telling WordPress, but that sounds scary to me.
Forum: Plugins
In reply to: [Media Sync] Rotate version createdJust my 2 cents.
Maybe we have a ‘upload’ versus ‘import’ issue here?The https://wordpress.org/plugins/fix-image-rotation/ plugin previously mentioned hooks the actual ‘generic’ file upload — this is not a Media Library function/filter. It is applied during the “get the file contents onto the server via WP admin” activity.
Media Sync does not ‘upload’ files. It works on files that are already on the server, and ‘imports’ them to the media library.
WordPress itself will process a file (creating ‘rotated’, ‘resized’, etc.) during import to the media library — but the ‘fix rotation’ plugin does not run at that point.
So, the question becomes: “Are the files being processed by Media Sync uploaded to the server via WordPress, or ‘manually’ via a file manager or some kind?”.
If via a file manager or some other batch process, then the ‘fix rotation’ plugin is not being invoked, and the default WP rotate logic has not been circumvented by it.
Sure would like to know if I have grokked the issue here. π
I just ran a test:
add_filter('woocommerce_admin_features', 'rwm_admin_features', 999); function rwm_admin_features ($features) { error_log( print_r($features, true ) ); return $features; }and this is the result.
[0] => activity-panels [1] => analytics [2] => analytics-dashboard [3] => analytics-dashboard/customizable [4] => coupons [5] => customer-effort-score-tracks [6] => homescreen [8] => mobile-app-banner [9] => onboarding [10] => remote-inbox-notifications [11] => shipping-label-banner [12] => store-alerts [13] => wcpayLooks like it may git-r-dun.
Of course, trying to figure out what these things are and do is a different story.Forum: Plugins
In reply to: [Payment Plugins for Stripe WooCommerce] Site Hard Down after v3.3.0 updateYour answer seems to be the best answer, and the initial test went A-OK.
I’ll mark this as resolved, and we’re following up via your Help system.Forum: Plugins
In reply to: [WooCommerce Stripe Payment Gateway] Site Hard Down after v3.3.0 updateYes sir – you are correct.
I have a copy of a few, but went the other way.- This reply was modified 5 years, 3 months ago by Simon Kane.
Forum: Plugins
In reply to: [WooCommerce Stripe Payment Gateway] Site Hard Down after v3.3.0 updateOh dang – Soooo many similar plugin names!
Thank you much for chiming in here!I’ll grab the pertinent stuff here and copy it over there.
Forum: Plugins
In reply to: [WooCommerce Stripe Payment Gateway] Site Hard Down after v3.3.0 updateOK – more research.
woo-stripe-payment/packages/blocks/src/Payments/PaymentsApi.php
has hard-coded lists of blocks to register (lines 48-135).
Triggers are:
public function __construct ….. $this->add_payment_methods();
and:
add_action( ‘woocommerce_blocks_payment_method_type_registration’, array( $this, ‘register_payment_methods’ ) );I do not see any filters to control which of the payment methods actually get loaded, but as the lists are hard-coded, they do not respect the existing ‘wc_stripe_payment_gateways’ filter.
If I had my way, the filter would totally prevent the actual gateway class modules (both kinds) from even being loaded (for server performance reasons), but at least for now, we can live with a way to remove the unwanted entries before they crash the site — or better yet, a filter (2 places) that supplies a list of the classes that are going to be registered, and remove unwanted entries.
Forum: Plugins
In reply to: [WooCommerce Stripe Payment Gateway] Site Hard Down after v3.3.0 updateOK – the issue has to do with “registered blocks” not matching the underlying payment methods. The fault is triggered at:
woo-stripe-payment/packages/blocks/src/Payments/AbstractStripePayment.php line 22 which is looking for a payment_method which has been suppressed by use of the long-existing ‘wc_stripe_payment_gateways’ filter.My filter overrides the $stripe_gateways array to only have the gateways my client wants.
However, as of v3.3.0 (blocks support), we now have a mismatch between the registered blocks and the loaded gateways.
Do I need to add a filter to “unregister” the unwanted stripe gateway ‘blocks’ ???
I have not used blocks, and have no reason to do so (at least for now LOL), but happy to implement forward-looking code to keep my clients happy.- This reply was modified 5 years, 3 months ago by Simon Kane.
It appears that you have not even looked at the code.
You have now changed your excuse from “it is not a minor change” to “The fields here work as intended”. I find that interesting.
I do hereby revoke my self-imposed restriction on sharing my enhancement code as per open source licensing guidelines.
Forum: Plugins
In reply to: [Media Sync] Selecting extensionGreat!
Dunno how I missed that existing filter.
Forum: Plugins
In reply to: [Media Sync] Selecting extensionHi!
I don’t see a filter for this, but I suspect that’s how he’ll want to do this – if he thinks it’s a good idea.
I think the filter call would go in the media_sync_import_files function of MediaSync.class.php just after the set of $is_in_db at line 568.
Looks like doing:
$is_in_db = apply_filters( ‘the name‘, $is_in_db, useful vars );would give you what’s needed.