Shashank Shekhar
Forum Replies Created
-
Hii @fizanzvai , as you asked for some sample code or my findings over this which you can pass that to your development team as input, so I given you few functions and links I found through my research which could be used.
Obviously I have already installed wp-graphql-woocommerce plugin along with wpgraphql , and that’s how I was able to fetch the product and its variations in first place, as mentioned the graphql request and response as example in start of this thread.
But the wpgraphql + woographql only returns the data of attributes which are default like name (eg. pa_color) and value (ex. red), but not gives your plugin’s custom attrbiute/term data and term meta like color hex code , attribute type: color/button/image values as this plugin doesn’t register these fields with graphql.
So, its for “Variation Swatches for WooCommerce” plugin need to do , to register its custom attribute term type and values with graphql (bcoz this plugin creates it and saves in the tables I mentioned before).
The functions I suggested are standard functions which can give those values, but where exactly need to write in what way in your plugin is something your dev team will better know, while registering those graphql fields and writing resolver to get those values using one or more of these functions.
Hope it will be available soon.- This reply was modified 2 years ago by Shashank Shekhar.
Thanks for responding @fizanzvai . I do not have exact code but mainly a combination of following functions may be needed to register and fetch fields in graphql, ie.
$product->get_attributes(); $attribute->get_variation(); $attribute->get_taxonomy(); $attribute->get_terms(); $attributes = wc_get_attribute_taxonomies(); get_term_meta($term->term_id, 'color', TRUE); // 'color' can be any dynamic attribute: size, memory, style as created wc_attribute_label($taxonomy) register_graphql_field() to register values via graphql_register_types hookHere few links that may help:
https://master–wpgraphql-docs.netlify.app/getting-started/custom-fields-and-meta/
https://github.com/wp-graphql/wp-graphql-meta-query
Also you will be surprised to know that this issue was asked around 4 years ago! But solution says to use ACF plugin instead of Variation Swatches for WooCommerce Plugin, so its easy to understand that its incompleteness since then is driving away the people from this plugin, see: https://stackoverflow.com/questions/60496743/how-to-get-term-meta-wpgraphql-woographql
Please share this info with your dev team. Hope we will get solution asap.
Any solution for this please?
On analysis I see that the product attribute types (button, color) are stored in wp_woocommerce_attribute_taxonomies table, and the actual color hex code etc for attribute term what we save with this plugin are stored in term_meta (wp_termmeta table).
How to get the values of this via graphql when we are listing a product attribute, I believe attribute term values may have meta {key:value} ex. {pa_color: #333, } also in response to get this (also the {type: button/color}).
Can you please suggest if it supported by plugin? Or otherwise a piece of code to get that extended data along with attribute values in graphql?I believe its not a big thing to add or suggest if not already, but its very important thing.
Otherwise this plugin will be of no use for headless wordpress/woocommerce.Will await for response.
Thank you very much much Paul.
I also was checking (although may be you have already checked), as per the official wpgraphql guide: https://www.wpgraphql.com/docs/settings#registering-custom-settingsfunction register_my_setting() { $args = [ 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'default' => NULL, 'show_in_graphql' => true, // This tells WPGraphQL to show this setting in the Schema ]; register_setting( 'my_options_group', 'my_option_name', $args ); } add_action( 'init', 'register_my_setting' );If Pods plugin be registering its fields group and fields with ‘show_in_graphql’ => true while saving configurations, the wordpress will be itself handle its security and access, and the group with fields be accessible with graphql query:
{ myOptionsGroupSettings { myOptionName } }https://www.wpgraphql.com/docs/settings#site-settings-by-settings-group
The mentioned links says that, I am not aware for deep data-format or compatibility with Pods plugin if any, as you know better being the plugin author, but looking on this it seems may be a small tweak in saving ‘setting page’ settings by Pods plugin may make it work self (handling permission/security by wp self further).Thank you for the hint Paul, I will look and try doing it with some code meanwhile.
Will be hoping although this important thing will be built in the Pods in near time when possible.Thank you for quick response Paul. Firstly Kudos for your great plugin for other promising features. But Graphql is now very common now a day for modern apps while using wordpress as a headless backend.
The https://docs.pods.io/code/wpgraphql-integration/ I checked, mentioned “Coming Soon support for Settings Page” https://pods-pro.skc.dev/downloads/wpgraphql-integration/ , got its in development. Any idea when its planned to provide that important function?
I see WPGraphQL filters link, thanks, but in Pods Settings Page fields case, the fields are being created dynamically in database, not a fixed name/code portion on which I can apply some filters or things.
Can you please provide a sample hook code portion, at least a pseudo code, how I can attach the newly created fields via pods to capture in graphql?
- This reply was modified 2 years, 1 month ago by Shashank Shekhar.
Juan,
The plugin latest version 3.31.0 is having issues with PHP version 8.3.3, and gives deprecated warnings.
I done debugging adn found this is due to some undeclared variables are being used in the constructor of YITH_WCWL class.
To fix this, go to
plugins\yith-woocommerce-wishlist\includes\class-yith-wcwl.php, and add declarations of four variables at line 45, as below:public $wcwl_frontend; public $wcwl_cron; public $wcwl_session; public $wcwl_admin;That’s it. It will fix the issue. Hope you release the updated version soon.
Hi @vaakash, hope u have considered this, posted 2 months ago, no replies. Any chance we could get this feature in next wp-socializer release soon? Will be great if yes!
Thanks.Its too disappointing that no one bother to answer this important question in past 2 months, even the author didn’t responded. Now using Len Slider 2.0.11 with wordpress 3.8.
But I somehow after so many hit and trials got a workaround for this.
In fact what I found is, Len Slider menu and settings doesn’t only need ‘Len Slider Manager'(lenslider_manage)capability; It needs ‘Activate Plugins’ (activate_plugins) capability in addition to it.
Don’t know why? but it now work with this and Len Slider menu now visible with user editor custom role login and settings can now be edited and saved for it.Earlier my custom role ‘sitadmin’ had only capability ‘Len Slider Manager'(lenslider_manage)and several other ones, becoz I didn’t want this user be able to see/activate/install plugins. But as to what I found now, for Len slider to work, I must have to give ‘Activate Plugins’ (activate_plugins) capability in addition to it. Now it worked, but this user can now see list and activate/deactivate plugins, which I don’t want.
Author requested to add this point in plugin description/faqs so other users benefit. Please someone explain and throw some light on it. Also, try to fix this vulnerability.
Thanks.
Is this issue considered? Please fix it.
Any update?
Any consideration? Any update regarding this?
Is this issue fixed in the recent version, or the plugin only going with the css updates??
Please someone respond and fix the major issues reported, else it may be marked broken.
Kindly consider.Is the recent version has fixed some issues, already asked for in the support threads??
There is no reply since then when the issues reported. Is the plugin working now, or its still broken??
Its changelog just showing only the css fixes, USELESS.. if plugin not working fine.
Does the plugin author check out the support threads and issues reported??Please consider.
I am also in need for this. There is no way from admin setting to disable/remove wp-socializer on certain post-types. for ex. I want share buttons for my blog posts but not want to share ‘portfolio’ custom post types.
I also searched alot but not found custom hooks/filters for wp-socializer using which I can remove the wp-socializer scripts/styles on certain post types.
Please let me know is it possible?