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

Add option to save changes to template back to template file #53249

Open
leonardola opened this issue Aug 1, 2023 · 1 comment
Open

Add option to save changes to template back to template file #53249

leonardola opened this issue Aug 1, 2023 · 1 comment
Labels
[Feature] Templates API Related to API powering block template functionality in the Site Editor [Type] Enhancement A suggestion for improvement.

Comments

@leonardola
Copy link

leonardola commented Aug 1, 2023

Description

When editing a template via the template editor it does not get saved back to the template file and is saved as a CPT instead.

This makes it harder to sync changes, requiring developers to use the export theme tool and then manually copy the changed files back to the theme they are working on and then reverting the changes in wp-admin to start picking the changes from the template file.

According to this comment, this is to be expected. So maybe adding an "update template file" button could create enough flexibility for developers and also keep the option to save as a CPT so customizations made by users won't be lost when there is a theme update.

Of course having a way to merge the theme updates and customizations would be the best way but I know it's not an easy task

Step-by-step reproduction instructions

  • Create a template inside /templates/test-template.html
  • Follow the instructions in this page to edit the template
  • Save the template
  • Go back to the template file
  • Notice the file was not updated

Screenshots, screen recording, code snippet

No response

Environment info

`

WordPress Environment

WordPress address (URL): http://test.local
Site address (URL): http://test.local
WC Version: 7.9.0
REST API Version: ✔ 7.9.0
WC Blocks Version: ✔ 10.4.6
Action Scheduler Version: ✔ 3.6.1
Log Directory Writable: ✔
WP Version: 6.2.2
WP Multisite: –
WP Memory Limit: 256 MB
WP Debug Mode: ✔
WP Cron: ✔
Language: en_US
External object cache: –

Server Environment

Server Info: Apache/2.4.43 (Unix)
PHP Version: 8.1.9
PHP Post Max Size: 1,000 MB
PHP Time Limit: 1200
PHP Max Input Vars: 4000
cURL Version: 7.84.0
(SecureTransport) OpenSSL/1.1.1q

SUHOSIN Installed: –
MySQL Version: 5.7.28
Max Upload Size: 300 MB
Default Timezone is UTC: ✔
fsockopen/cURL: ✔
SoapClient: ✔
DOMDocument: ✔
GZip: ✔
Multibyte String: ✔
Remote Post: ✔
Remote Get: ✔

Database

WC Database Version: 7.9.0
WC Database Prefix: wp_
Total Database Size: 5.98MB
Database Data Size: 4.51MB
Database Index Size: 1.47MB
wp_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_order_itemmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_actionscheduler_actions: Data: 0.02MB + Index: 0.11MB + Engine InnoDB
wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_actionscheduler_logs: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_comments: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_options: Data: 3.48MB + Index: 0.06MB + Engine InnoDB
wp_postmeta: Data: 0.05MB + Index: 0.03MB + Engine InnoDB
wp_posts: Data: 0.05MB + Index: 0.06MB + Engine InnoDB
wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_usermeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_wc_admin_notes: Data: 0.06MB + Index: 0.00MB + Engine InnoDB
wp_wc_admin_note_actions: Data: 0.05MB + Index: 0.02MB + Engine InnoDB
wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_product_attributes_lookup: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
wp_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB

Post Type Counts

acf-field: 1
acf-field-group: 1
attachment: 4
customize_changeset: 1
page: 11
post: 2
product: 4
product_variation: 2
revision: 4
wp_global_styles: 1
wp_template: 3

Security

Secure connection (HTTPS): ❌
Your store is not using HTTPS. Learn more about HTTPS and SSL Certificates.
Hide errors from visitors: ✔

Active Plugins (6)

Advanced Custom Fields: by WP Engine – 6.1.7
Buy Once or Subscribe for WooCommerce Subscriptions: by eCommerce Tools – 4.0.0
WooCommerce Payments Dev Tools: by Automattic –
WooCommerce Payments: by Automattic – 6.2.2
WooCommerce Subscriptions: by WooCommerce – 5.3.1
WooCommerce: by Automattic – 7.9.0

Inactive Plugins (0)

Must Use Plugins (1)

mu-loader.php: by –

Settings

API Enabled: –
Force SSL: –
Currency: USD ($)
Currency Position: left
Thousand Separator: ,
Decimal Separator: .
Number of Decimals: 2
Taxonomies: Product Types: external (external)
grouped (grouped)
simple (simple)
subscription (subscription)
variable (variable)
variable subscription (variable-subscription)

Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
exclude-from-search (exclude-from-search)
featured (featured)
outofstock (outofstock)
rated-1 (rated-1)
rated-2 (rated-2)
rated-3 (rated-3)
rated-4 (rated-4)
rated-5 (rated-5)

Connected to WooCommerce.com: –
Enforce Approved Product Download Directories: ✔
HPOS feature screen enabled: –
HPOS feature enabled: –
Order datastore: WC_Order_Data_Store_CPT
HPOS data sync enabled: –

WC Pages

Shop base: #6 - /shop/
Cart: #7 - /cart/
Checkout: #8 - /checkout/
My account: #9 - /my-account/
Terms and conditions: ❌ Page not set

Theme

Name: Test
Version: 1.0.0
Author URL: https://wpspecialprojects.wordpress.com
Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme
WooCommerce Support: ❌ Not declared

Templates

Overrides: –

Subscriptions

WCS_DEBUG: ✔ No
Subscriptions Mode: ✔ Live
Subscriptions Live URL: http://test.local/
Subscriptions-core Library Version: 6.1.0
Subscription Statuses: –
WooCommerce Account Connected: ❌ No
Report Cache Enabled: ✔ Yes
Cache Update Failures: ✔ 0 failure

Store Setup

Country / State: United States (US) — California

Subscriptions by Payment Gateway

Payment Gateway Support

WooPayments: products
refunds
multiple_subscriptions
subscription_cancellation
subscription_payment_method_change_admin
subscription_payment_method_change_customer
subscription_payment_method_change
subscription_reactivation
subscription_suspension
subscriptions
subscription_amount_changes
subscription_date_changes
tokenization
add_payment_method

Admin

Enabled Features: activity-panels
analytics
product-block-editor
coupons
core-profiler
customer-effort-score-tracks
import-products-task
experimental-fashion-sample-products
shipping-smart-defaults
shipping-setting-tour
homescreen
marketing
mobile-app-banner
navigation
onboarding
onboarding-tasks
remote-inbox-notifications
remote-free-extensions
payment-gateway-suggestions
shipping-label-banner
subscriptions
store-alerts
transient-notices
woo-mobile-welcome
wc-pay-promotion
wc-pay-welcome-page

Disabled Features: minified-js
new-product-management-experience
product-variation-management
settings
async-product-editor-category-field

Daily Cron: ✔ Next scheduled: 2023-08-02 16:43:35 +00:00
Options: ✔
Notes: 69
Onboarding: completed

WooCommerce Payments

Version: 6.2.2
Connected to WPCOM: Yes
Blog ID: 221885771
Account ID: acct_1NaLlTQxpTR0MNHm

Action Scheduler

Complete: 23
Oldest: 2023-08-01 16:44:45 +0000
Newest: 2023-08-01 17:53:38 +0000

Failed: 1
Oldest: 2023-08-01 16:54:23 +0000
Newest: 2023-08-01 16:54:23 +0000

Pending: 1
Oldest: 2023-08-02 16:44:45 +0000
Newest: 2023-08-02 16:44:45 +0000

Status report information

Generated at: 2023-08-01 19:38:32 +00:00
`

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@leonardola leonardola changed the title Template not being saved Template not being saved back to file Aug 1, 2023
@leonardola leonardola changed the title Template not being saved back to file Add option to save changes to template back to template file Aug 1, 2023
@jordesign jordesign added [Type] Enhancement A suggestion for improvement. [Feature] Templates API Related to API powering block template functionality in the Site Editor labels Aug 1, 2023
@Mamaduka
Copy link
Member

Mamaduka commented Aug 2, 2023

I think Create Block Theme provides this functionality.

I'm unsure if this will be part of the core. Allowing file updates in production environments can affect security.

Cc. @WordPress/theme-team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Templates API Related to API powering block template functionality in the Site Editor [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants