solidus icon indicating copy to clipboard operation
solidus copied to clipboard

Add structured data fields to Spree stores

Open rahulsingh321 opened this issue 11 months ago • 12 comments

Summary

This Commit provides the possibility to store legal information in the store resource. Given the wide array of different information required by country, the information stored here provides a baseline for most countries, but might need to be augmented in some jurisdictions. This commit is not meant as legal advisory. Inform yourself about eventual requirements in your country of operation.

Some additional information that might be needed:

  • Legal Representative,
  • Share Capital of the company,
  • Contacts for privacy.

Schema.org has a schema to markup organizations that has been widely adopted by various search engines:

https://schema.org/Organization Support / Docs
Bing https://www.bing.com/webmasters/help/?topicid=cc507c09
Google https://developers.google.com/search/docs/appearance/structured-data/organization
Yandex https://yandex.com/support/webmaster/schema-org/what-is-schema-org.html

This update allows to return all organization data on frontend via jsonb if implemented according to schema documentation on a per store basis and edit the data via API and Backend (Old / New).

The implemented fields are:

  • legal_name,
  • contact_email,
  • contact_phone,
  • vat_id,
  • tax_id,
  • address1,
  • address2,
  • Zip code and city,
  • state_name,
  • country_id,
  • and state_id.

Some additional notes regarding the size of the commit: While this commit seems massive in size, no functionality has been added apart from storing the values, no logical changes have been made, hence the commit while bigger in size is simple to analyse. Apart from testing routines, this commit does not contain functional code. Where possible the structure of current address forms has been adopted.

Fixes https://github.com/solidusio/solidus/issues/6173

Screenshot

Screenshot from 2025-03-02 17-48-07 Screenshot from 2025-03-02 17-47-52 Screenshot from 2025-03-02 17-47-35 Sample-Store-Stores-03-04-2025_10_02_PM

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

rahulsingh321 avatar Feb 10 '25 19:02 rahulsingh321

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 88.86%. Comparing base (7d8a10d) to head (fc8e744).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6113      +/-   ##
==========================================
+ Coverage   86.64%   88.86%   +2.21%     
==========================================
  Files         514      838     +324     
  Lines       11894    18234    +6340     
==========================================
+ Hits        10306    16203    +5897     
- Misses       1588     2031     +443     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Feb 17 '25 19:02 codecov[bot]

  1. Please restructure the form order as in attached image
  2. contact email is missing on forms
  3. Save button should be at right top and right bottom as in figma (https://www.figma.com/design/h7eZRxh8KhPakTMr7c9NlB/Solidus-%E2%80%94-Admin-Dashboard?node-id=419-7816&p=f&t=u5VE4L1wTTlfzrkw-0)
  4. Make separate cards according to mock up for old backend
  5. Add context info to VAT-ID field: vat-id-hint for en.yml "Enter your VAT-ID without the Country Prefix (eg IT for Italy or DE for Germany) but solely the identification string."
Screenshot 2025-02-27 at 19 59 39

fthobe avatar Feb 27 '25 19:02 fthobe

@rahulsingh321 in future PRs I kindly ask you to follow @tvdeyen more on the commit structure. Commit 1: Add Columns Commit 2: Add API and API Description Commit 3: Add tests Commit 4: Add Admin UI Admin Backend Commit 4: Add Admin UI New Admin Backend

fthobe avatar Feb 27 '25 19:02 fthobe

@tvdeyen @kennyadsl looks good to me I know it looks like a huge commit but it's only a couple of columns on stores without any logic other than altering the content. We also found a little bug in the formfields during the work that @chaimann had the courtesy to fix. I am making a change request against schema.org tonight hoping to alter it to reflect all legally required data across all jurisdictions but that depends on them to accept it.

fthobe avatar Mar 04 '25 10:03 fthobe

@kennyadsl can we review this, it should be good to go.

fthobe avatar Mar 06 '25 18:03 fthobe

@fthobe please stop framing PRs and issues "your way" in the PR title. Thanks.

tvdeyen avatar Mar 10 '25 09:03 tvdeyen

@fthobe please stop framing PRs and issues "your way" in the PR title. Thanks.

@tvdeyen could you suggest a better name to get a hang of it? The resource is stores and the fields we add are the structured data fields. Please advise, not being condescending, trying to learn.

fthobe avatar Mar 10 '25 09:03 fthobe

We should use the existing address form component, instead of introducing a second one. Also the PR adds a general new admin form for managing stores, which is very much appreciated, but this should at least be a dedicated commit the extra builds on top of and should no be combined into one commit, otherwise it is hard to see what the actual change (from your PR title) is.

We can separate the new admin from the rest.

fthobe avatar Mar 10 '25 09:03 fthobe

@tvdeyen replied to your comments

fthobe avatar Mar 10 '25 09:03 fthobe

@fthobe please stop framing PRs and issues "your way" in the PR title. Thanks.

@tvdeyen could you suggest a better name to get a hang of it? The resource is stores and the fields we add are the structured data fields. Please advise, not being condescending, trying to learn.

The name is ok, the "[Tag]"-Part is unnecessary

tvdeyen avatar Mar 10 '25 10:03 tvdeyen

@tvdeyen I worked with the guys of schema to adjust the Organization tags a little and complete them for European entities as well and if no objections are raised that passes next week.

Was there anything else to complain about other than the address form?

Given the previous discussions the address list for me is a dead cow and I would like to store this in simple columns. Is that ok for you?

fthobe avatar Apr 09 '25 13:04 fthobe

@tvdeyen do I close this or leave it open? It provides full imprint / impressum via the store resource. I extended the structured data model on schema as well.

fthobe avatar Apr 11 '25 18:04 fthobe