Dear Sir/Madam,
I have many merchants who have many coupons, advertisers also have many coupons, sometimes the same coupons will be shared with other merchants or advertisers use. How can I set the relationship between these merchant, advertiser and coupon custom post?
Relationship case 1
merchant-coupon
advertiser-coupon
Relationship case 2
coupon-merchant
coupon-advertiser
Relationship case 3
merchant-coupon
coupon-advertiser
Which case is setting most appropriate?
Best regards,
Kelvin.
Dear Kelvin,
For the question:
many merchants who have many coupons
It needs to setup many-to-many relationship between post type "merchants" and "coupons"
advertisers also have many coupons
If one "coupon" post can connect to multiple "advertiser" posts, same as above:
setup many-to-many relationship between post type "advertiser" and "coupons"
More help:
Creating and Displaying Many-to-Many Post Relationships
https://toolset.com/documentation/user-guides/many-to-many-post-relationship/
Dear Luo Yang,
Thanks for your reply. I read the Creating and Displaying Many-to-Many Post Relationships before ask.
Is there any difference between merchant-coupon and coupon-merchant?
Best regards,
Kelvin.
It depends on what you are going to achieve, for example, if you are going to:
One "merchant" post can connect to multiple "coupon" posts,
One "coupon" post can connect to multiple "merchant" posts,
Same as above, it needs many-to-many relationship
If you are going to:
One "merchant" post can connect to multiple "coupon" posts,
One "coupon" post can connect to only one "merchant" post
it needs one parent/child relationship, setup "merchant" as parent post type of "coupon"
Hope it is clear
Dear Luo Yang,
Yes, I got your answer. My question is the setting to the many-to-many relationship, is there a difference if I choose merchant on the left or right-hand side?
No, there isn't difference on the left or right-hand side.