Bi-directional with auto-polpulate
-
Hi,
Can anyone, please, advise a tutorial on creating a bi-directional relationship with auto-population?
Thank you.
-
Can you be more specific about what you mean by “auto-population”?
Let me explain my use case:
I have created a new post type named “Shipment”. Again using Pods I have extended the WooCommerce Orders post type with a relationship field to the “Shipment” custom post type. Now when I edit an order, I can create a ‘Shipment’ linked to it. All is OK up to here. But I would like the created shipment record to be linked back to that order (using the bi-directional relationship feature).
Any help on how to do that would be appreciated.
Hi @msamavi
This happens automatically once you’ve created the bi-directional relationship.
Both CPT’s will require a relationship field linked to eachother.
Once that is done it will automatically update the other side of either are updated.Cheers, Jory
Hi @keraweb
Thanks for the prompt reply.
I have created a bi-directional relationship field in the “Shipment” CPT; But the order is not being selected automatically by that field, it shows just the list of available orders!Regards
Hi @msamavi
In that case I think you didn’t link the relationship fields yet.
Also, older field values are not automatically updated.
https://docs.pods.io/fields/relationship/Cheers, Jory
Hi @keraweb
Yes I did link the relationship field, but still not auto-populated (linked back)!
Regard
P.S.
I used to work with Drupal projects and there were wonderful plugins for custom fields, relationships, views, rules, and access levels. To be honest, I am disappointed with WordPress despite of such big commercial and public plugin varieties and communities!@sc0ttkclark @keraweb I’m seeing the same issue as @msamavi in testing — extended WooCommerce Orders, created a bi-directional relationship to a CPT called Shipments. The bi-directional field saves to the order, but doesn’t show on the shipment. Double-checked the field shows as bi-directional on both Orders and Shipments.
Dear @pdclark
I appreciate your time in generating the screencast and confirming the issue!Found the issue.
This is actually not a bug but a config issue related to the post status.
WooCommerce implement new types of post statuses for their orders like “completed”, “on hold” etc.
You’ll have to include these in your field filters under “Relationship Options” > “Limit list by Post Status”.Cheers, Jory
Thanks @keraweb for the comment, but that did not work for me!
Hi @msamavi,
Then I cannot reproduce your issue locally.
Are you sure you have configured the post status filters correctly? You need to include all of the WooCommerce related order statuses:
https://woocommerce.com/document/managing-orders/#order-statusesDoing so fixed the issue for me.
Cheers, Jory
@msamavi — I can confirm that selecting all the Post Status options under Relationship Options on the Shipments relationship field resolved the issue for me as well. Perhaps make sure you’re selecting the Post Statuses on the field attached to Shipments, not Orders?
Hi @pdclark
This is the screenshot from my settings:
https://www.dropbox.com/s/kkdrpxb1m3plth0/Screenshot%202022-11-25%20at%204.33.23%20PM.png?dl=1
I would appreciate it if you could find some time to reproduce some screens of your settings for me.
The topic ‘Bi-directional with auto-polpulate’ is closed to new replies.