如何在Woocommerce中将产品添加到购物车时更改成功消息?

时间:2017-12-04 13:29:41

标签: php ajax wordpress woocommerce

嗯,通过ajax将产品添加到购物车的功能是100%正常工作,但下面的消息显示为

enter image description here

嗯,生成的代码就是这样,只要产品成功添加到购物车中就会自动生成

dbms.security.allow_csv_import_from_file_urls=true

apoc.export.file.enabled=true
apoc.import.file.enabled=true
apoc.import.file.use_neo4j_config=true
dbms.security.procedures.unrestricted=apoc.*
dbms.security.procedures.white_list=apoc.load.*

dbms.security.procedures.unrestricted=apoc.*
dbms.security.procedures.unrestricted=apoc.cypher.*
dbms.security.procedures.unrestricted=apoc.trigger.*,apoc.meta.*
NEO4J_dbms_security_procedures_unrestricted=apoc.\\\*
dbms.security.procedures.whitelist=apoc.coll.*,apoc.load.*


# Require (or disable the requirement of) auth to access Neo4j
dbms.security.auth_enabled=true
dbms.security.procedures.whitelist=apoc.*
dbms.security.procedures.whitelist=apoc.coll.*,apoc.load.*
dbms.security.procedures.unrestricted=apoc.trigger.*,apoc.meta.*
NEO4J_dbms_security_procedures_unrestricted=apoc.\\\*

# With default configuration Neo4j only accepts local connections.
# To accept non-local connections, uncomment this line:
#dbms.connectors.default_listen_address=0.0.0.0

name    signature   description
"apoc.coll.partition"   "apoc.coll.partition(values :: LIST? OF ANY?, batchSize :: INTEGER?) :: (value :: LIST? OF ANY?)"   "apoc.coll.partition(list,batchSize)"
"apoc.coll.split"   "apoc.coll.split(values :: LIST? OF ANY?, value :: ANY?) :: (value :: LIST? OF ANY?)"   "apoc.coll.split(list,value) | splits collection on given values rows of lists, value itself will not be part of resulting lists"
"apoc.coll.zipToRows"   "apoc.coll.zipToRows(list1 :: LIST? OF ANY?, list2 :: LIST? OF ANY?) :: (value :: LIST? OF ANY?)"   "apoc.coll.zipToRows(list1,list2) - creates pairs like zip but emits one row per pair"
"apoc.load.csv" "apoc.load.csv(url :: STRING?, config :: MAP?) :: (lineNo :: INTEGER?, list :: LIST? OF ANY?, map :: MAP?)" "apoc.load.csv('url',{config}) YIELD lineNo, list, map - load CSV fom URL as stream of values,\n config contains any of: {skip:1,limit:5,header:false,sep:'TAB',ignore:['tmp'],arraySep:';',mapping:{years:{type:'int',arraySep:'-',array:false,name:'age',ignore:false}}"
"apoc.load.driver"  "apoc.load.driver(driverClass :: STRING?) :: VOID"  "apoc.load.driver('org.apache.derby.jdbc.EmbeddedDriver') register JDBC driver of source database"
"apoc.load.jdbc"    "apoc.load.jdbc(jdbc :: STRING?, tableOrSql :: STRING?, params = [] :: LIST? OF ANY?) :: (row :: MAP?)" "apoc.load.jdbc('key or url','table or statement') YIELD row - load from relational database, from a full table or a sql statement"
"apoc.load.jdbcParams"  "apoc.load.jdbcParams(jdbc :: STRING?, sql :: STRING?, params :: LIST? OF ANY?) :: (row :: MAP?)"   "deprecated - please use: apoc.load.jdbc('key or url','statement',[params]) YIELD row - load from relational database, from a sql statement with parameters"
"apoc.load.jdbcUpdate"  "apoc.load.jdbcUpdate(jdbc :: STRING?, query :: STRING?, params = [] :: LIST? OF ANY?) :: (row :: MAP?)"    "apoc.load.jdbcUpdate('key or url','statement',[params]) YIELD row - update relational database, from a SQL statement with optional parameters"
"apoc.load.json"    "apoc.load.json(url :: STRING?, path = :: STRING?, config = {} :: MAP?) :: (value :: MAP?)" "apoc.load.json('url',path, config) YIELD value - import JSON as stream of values if the JSON was an array or a single value if it was a map"
"apoc.load.jsonArray"   "apoc.load.jsonArray(url :: STRING?, path = :: STRING?) :: (value :: ANY?)" "apoc.load.jsonArray('url') YIELD value - load array from JSON URL (e.g. web-api) to import JSON as stream of values"
"apoc.load.jsonParams"  "apoc.load.jsonParams(url :: STRING?, headers :: MAP?, payload :: STRING?, path = :: STRING?, config = {} :: MAP?) :: (value :: MAP?)"  "apoc.load.jsonParams('url',{header:value},payload, config) YIELD value - load from JSON URL (e.g. web-api) while sending headers / payload to import JSON as stream of values if the JSON was an array or a single value if it was a map"
"apoc.load.ldap"    "apoc.load.ldap(connection :: ANY?, search :: MAP?) :: (entry :: MAP?)" "apoc.load.ldap(\"key\" or {connectionMap},{searchMap}) Load entries from an ldap source (yield entry)"
"apoc.load.xml" "apoc.load.xml(url :: STRING?, path = / :: STRING?, config = {} :: MAP?, simple = false :: BOOLEAN?) :: (value :: MAP?)"    "apoc.load.xml('http://example.com/test.xml', 'xPath',config, false) YIELD value as doc CREATE (p:Person) SET p.name = doc.name load from XML URL (e.g. web-api) to import XML as single nested map with attributes and _type, _text and _childrenx fields."
"apoc.load.xmlSimple"   "apoc.load.xmlSimple(url :: STRING?) :: (value :: MAP?)"    "apoc.load.xmlSimple('http://example.com/test.xml') YIELD value as doc CREATE (p:Person) SET p.name = doc.name load from XML URL (e.g. web-api) to import XML as single nested map with attributes and _type, _text and _children fields. This method does intentionally not work with XML mixed content."

我想知道如何编辑此特定行

2 个答案:

答案 0 :(得分:0)

@credited to helgatheviking,回答here

您可以通过woocommerce_get_checkout_url

过滤结帐网址
function so_37863005_checkout_url( $url ){

    // Force SSL if needed
    $scheme = ( is_ssl() || 'yes' === get_option( 'woocommerce_force_ssl_checkout' ) ) ? 'https' : 'http';
    $url = site_url( '/custom-page/', $scheme );

    return $url;
}
add_filter( 'woocommerce_get_checkout_url', 'so_37863005_checkout_url', 10, 2 );

尝试这种独特的方式

function text_view_cart_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
    case 'View Cart' :
        $translated_text = __( 'Check On Out', 'woocommerce' );
        break;
}
return $translated_text;
}
add_filter( 'gettext', 'text_view_cart_strings', 20, 3 );

答案 1 :(得分:0)

每次都适合我。让我知道它是否适合你。

/**
 * @snippet       Edit "successfully added to your cart"
 * @how-to        Watch tutorial @ https://businessbloomer.com/?p=19055
 * @sourcecode    https://businessbloomer.com/?p=494
 * @author        Rodolfo Melogli
 * @testedwith    WooCommerce 2.5.2
 */

add_filter( 'wc_add_to_cart_message', 'bbloomer_custom_add_to_cart_message' );

function bbloomer_custom_add_to_cart_message() {

global $woocommerce;
$return_to  = get_permalink(woocommerce_get_page_id('shop'));
$message    = sprintf('<a href="%s" class="button wc-forwards">%s</a> %s', $return_to, __('Continue Shopping', 'woocommerce'), __('Product successfully added to your cart.', 'woocommerce') );
return $message;
}