Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shipping Block Extension #49

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bilfeldt
Copy link
Member

Options are being displayed in the frontend but there values stored in the order details part remaining

Options are being displayed in the frontend but there values stored in the order details part remaining
Copy link
Member Author

@bilfeldt bilfeldt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First of all, formatting of all files must be performed. Please use the wordpress coding standards to format all files according to standard.

Secondly then it seems there are way too many files in this PR. My guess is there is a lot of boilerplate/copy that can easily be deleted?

Note that in many places then there is a lot of naming (file name/namespace/folder/variables) like shipping-workshop and alternateShippingInstruction which is clearely a leftover from copying from another plugin. These names should be adjusted to what this is "pickup-point"

"apiVersion": 3,
"name": "create-block/shipping-workshop",
"version": "1.0.0",
"title": "Shipping Workshop",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The title should be the displayed name.

Consider something like:

Suggested change
"title": "Shipping Workshop",
"title": "Pick-up Point checkout",

{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "create-block/shipping-workshop",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This name does not follow the specs: https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#name

The name for a block is a unique string that identifies a block. Names have to be structured as namespace/block-name, where namespace is the name of your plugin or theme.

Suggested change
"name": "create-block/shipping-workshop",
"name": "smart-send/pick-up-points",

"version": "1.0.0",
"title": "Shipping Workshop",
"category": "widgets",
"icon": "palmtree",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"icon": "palmtree",
"icon": "list-view",

"title": "Shipping Workshop",
"category": "widgets",
"icon": "palmtree",
"textdomain": "shipping-workshop",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to match the plugin's Text Domain

Suggested change
"textdomain": "shipping-workshop",
"textdomain": "smart-send-logistics",

"name": "create-block/shipping-workshop",
"version": "1.0.0",
"title": "Shipping Workshop",
"category": "widgets",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a description:

Suggested change
"category": "widgets",
"description": "Show pick-up point selector during checkout for relevant shipping methods"
"category": "widgets",

city,
street
) {
// Sanitize inputs
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does that mean?

Comment on lines +1 to +30
{
"apiVersion": 2,
"name": "shipping-workshop/shipping-workshop-block",
"version": "2.0.0",
"title": "Alternative Shipping Options Block",
"category": "woocommerce",
"description": "Adds a select field to let the shopper choose alternative shipping instructions.",
"supports": {
"html": false,
"align": false,
"multiple": false,
"reusable": false
},
"parent": [ "woocommerce/checkout-shipping-methods-block" ],
"attributes": {
"lock": {
"type": "object",
"default": {
"remove": true,
"move": true
}
},
"text": {
"type": "string",
"default": ""
}
},
"textdomain": "shipping-workshop",
"editorStyle": "file:../../../build/style-shipping-workshop-block.css"
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of this need to be adjusted. This is copyed from somewhere else and not adjusted. The apiVersion is also old?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this used for?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file, shipping-workshop-block/edit.js, is used for adding fields or options to the shipping workshop block in the dashboard's block editor. It defines the editing interface for the block, allowing users to configure various settings and options related to the "smart_send" logistics shipping method. This includes rendering the necessary input fields, handling user interactions, and updating the block's state as users make changes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file actually used or a left over? There is also a src/js/shipping-workshop-block/block.json file?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The smart-send-logistics/block.json file is indeed used and not a leftover. It is responsiblefor registering the main shipping workshop block in WooCommerce and informing WordPress about the block's associated script and style files. This ensures that the block is properly integrated and functional within the WordPress and WooCommerce environments.On the other hand, the src/js/shipping-workshop-block/block.json file is used to define the inner blocks, their specific configurations, and essential details. This file provides information necessary for the proper rendering and behaviour of the inner blocks within the shipping workshop block.Both files are crucial for the correct setup and operation of the shipping workshop block and its components.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this used for?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The smart-send-logistics/src/js/style.scss file is used to define the styles for the frontend of our block. This SCSS (Sass) file contains the styling rules that determine the appearance and layout of the shipping workshop block when it is rendered on the website. It ensures that the block is visually consistent with the overall design of the site and provides a better user experience by applying custom styles such as colors, fonts, spacing, and other CSS properties.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants